PHP include for certain URLs via IF statement
-
I want to show certain content in my sidebar for certain URLs.
The following example is for using an include for the homepage, but I can’t get it to work in WordPress:
<!-- begin homepage ads --> <?php $homepage = "/"; $currentpage = $_SERVER['REQUEST_URI']; if($homepage==$currentpage) { include('homepage-ads.php'); } ?> <!-- end homepage ads -->How would I get it to include a .php file if it’s NOT the homepage?
Can I set a string of commands, in layman’s terms:
if is: /page1 , include page1_ads.php
if is: /green-page , include green-page_ads.php
if is: /another-page , include another-page_ads.php
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘PHP include for certain URLs via IF statement’ is closed to new replies.