WordPress.org

Support

Support » How-To and Troubleshooting » Problem getting conditional statement to work in sidebar

Problem getting conditional statement to work in sidebar

  • I’ve got the following code which should be displaying a different block of code in my sidebar if the user is on the home page.

    I’ve set up my front page to be a static page and to use a custom template. It’s doing all of that correctly, it’s just as if my sidebar isn’t seeing the page as the front page.:

    <?php if (is_front_page() ) { ?>
    <div id="sidebar-home" class="column span-5 last">
    <p>this page IS the home page</p>
    </div>
    
    <?php } else { ?>
    <div id="sidebar" class="column span-5 last" >
    <p>this page isn't the home page</p>
    </div>
    <?php } ?>

    It isn’t working, what am I missing.

    thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem getting conditional statement to work in sidebar’ is closed to new replies.
Skip to toolbar