• I wanted certain text to show up on the sidebar for a page with the page slug of “franchise” of my wordpress site.

    I discovered that it will work if the code looks like this;

    <?php /* ElseIf a "page",  */ } elseif (is_page() || is-page('franchise')) { ?>
    
    some text goes here
    
     <?php } ?>

    But the problem is that I don’t want the text to show up for the other pages as evidenced in the (is_page() snippet above.

    So then, I tried to go for this below;

    <?php /* ElseIf a "page",  */ } elseif (is_page()) { ?>
    
    blah, blah
    
     <?php /* ElseIf a "page" called Franchise */ } elseif (is_page('franchise')) { ?>
    
    some text goes here
    
           <?php } ?>

    But apparently, this won’t work at all. No text will show up on the sidebar for the page slug of ‘franchise’

    Anyone here familiar with WordPress to help me understand why the 2nd option won’t work and how can I make it work so that only one page will see certain text?

    Thanks!

  • The topic ‘getting elseif statements to work correctly’ is closed to new replies.