I have been trying this for hours
<?php
if ($_SERVER['SERVER_NAME']=='http://www.testground.idghosting.com/idi' && $_SERVER['REQUEST_URI'] == 'our-production/') {
echo '<div id="services">
<h1>Our services</h1>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_productions" title="Our Productions"><span>Our Productions</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_services" title="Production Services"><span>Production Services</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_equipment" title="Equipment & Facilities"><span>Equipment & Facilities</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_pr" title="PR & Media"><span>PR & Media</span></a>
</div>';
} else {
echo '<div> do not show</div>';
} ;
?>
but no luck... a help would be very much appreciated..
You also have an extra semi-colon:
</div>';
} else {
echo '<div> do not show</div>';
} ;
// ^ remove this semi-colon
That's never going to match because $_SERVER['SERVER_NAME'] is just the domain name of the server, not the url itself.
Some of the items in the $_SERVER array that may be of use to you:
One thing I like to do for handling code that gets executed for development and not on a live site is to create a define based on the hostname.
For example:
define('IS_LIVE', (strstr($_SERVER['SERVER_NAME'], 'mytestserver') ? true : false));
If I put that define somewhere that gets called for every page, then elsewhere in my code, I can do this:
if(!IS_LIVE) {
//Do development-debugging stuff
}
Use
if(substr($_SERVER["REQUEST_URI"], 0, 4) == "/idi" //followed by your other code
I have the solution....
<?php
//use body ID to whick page you want to dipaly a block
if (is_page(array('bodyid','bodyid', 'bodyid'))) { ;?>
<div id="services">
<h1>Our services</h1>
<a href="<?php bloginfo('url'); ?>" id="serv_productions" title="Our Productions"><span>Our Productions</span></a>
<a href="<?php bloginfo('url'); ?>" id="serv_services" title="Production Services"><span>Production Services</span></a>
<a href="<?php bloginfo('url'); ?>" id="serv_equipment" title="Equipment & Facilities"><span>Equipment & Facilities</span></a>
<a href="<?php bloginfo('url'); ?>" id="serv_pr" title="PR & Media"><span>PR & Media</span></a>
</div>
<?php } ?>