• I want to be able to hide the side bar on some pages.
    I know that this is probably not the correct syntax, but something like this…

    <?php if(is_page('page ID=30')): ?>
    <?php hide_sidebar(); ?>
    <? endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • You have the right idea, but not quite the right way to go about it. You would want to use something like this:

    <?php
    if(!is_page(30)) :
    get_sidebar();
    endif; ?>

    The exclamation point is code for “not”, so you’re telling WordPress, “If this is not the page I specify, then display the sidebar. Otherwise, skip the sidebar.”

    See the is_page() page for more specifics about the is_page() function.

    Thread Starter kloy

    (@kloy)

    thanks…I knew it was something like that.
    I just started to learn php. Thanks, it worked like a charm!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hide sidebar on some pages’ is closed to new replies.