WordPress.org

Ready to get started?Download WordPress

Forums

Problem getting conditional statement to work in sidebar (2 posts)

  1. brianfidler
    Member
    Posted 3 years ago #

    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

  2. threestyler
    Member
    Posted 3 years ago #

    You could try if ( is_page('about') instead?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.