Hi I've been working on this for a while now but I'm no expert in php. I'm trying to show a certain div only on the homepage. <div> <?php if(strpos($_SERVER['REQUEST_URI'],'/home/')===true) if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Header Widget Area Slider')) }else{ <?php endif;?> <?php :?> </div>
Do you use URL Rewrite to load your pages? Eg is example.com/home actually example.com/index.php?page=home? If so, you could change your code to: <?php if($_GET['page'] == 'home' OR empty($_GET['page'])){ // change the variable... // check for the function existing function if(function_exists('dynamic_sidebar'){ // show the sidebar dynamic_sidebar('Header Widget Area Slider'); } } ?> PHP:
Thanks for the quick reply! Not sure what URL rewrite is...? I've used wordpress to create the major part of the website but am now finetuning in the code. If wordpress comes with URL rewriting then yes, if not then I'm pretty sure the website does not use it as I didn't add any code as such. Your code gives a syntax error in my php editor on line 4. I'm a very beginner so fixing this myself is fairly impossible If this expected?
Sorry for the sytnax error, I typed it quickly and missed a bracket. Since you're using Wordpress, there is a function available within Wordpress to check for the homepage: Use is_home() PHP: if you have a static front page: http://codex.wordpress.org/Function_Reference/is_home Or is_front_page() PHP: if you use a front page (the page which shows posts in order of creation). You could also use is_page('PageName') PHP: to check the page name. http://codex.wordpress.org/Function_Reference/is_page