• I’ve tried doing this by page slug name and number, but neither seems to work. Any ideas?

    <?php if (is_front_page()) { ?>
    
    		<div class="header-background-image"></div>
    
    		<header id="header-global" role="banner">
    
    	<?php } elseif (is_single()) { ?>
    
    		<div id="post-header-override" class="header-background-image"></div>
    
    		<header id="header-post" role="banner">
    
    	<?php } elseif (is_page(22)) { ?>
    
    		<div id="post-header-override" class="header-background-image"></div>
    
    		<header id="header-post" role="banner">		
    
    	<?php } else { ?>
    
    		<div class="header-background-image-inner"></div>
    
    		<header id="header-global-inner" role="banner">
    
    	<?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Are you using a custom query or several loops on the header? Try to insert

    You should be able to figure this out with some simple de-bugging…

    What does this show?

    <?php
        echo "<p>Page ID: '".$post->ID."', Front page: '".is_front_page ()."', Single: '".is_single ()."', Page 22: '".is_page (22)."'</p>";
    ?>

    Look at the results of that and you’ll see what is and isn’t giving you the right results.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Issues with IfElse Statement in Header’ is closed to new replies.