• Hi –

    I have the following PHP statement that adds a sidebar (named page-header) to my site, except I want to modify it so that it EXCLUDES this particular sidebar from the homepage. Can anyone help modify to make the sidebar NOT show up on the home page? Thanks!

    <?php /* Widgetized sidebar */
        if  (!function_exists('dynamic_sidebar') || !dynamic_sidebar('page-header') ) : ?><?php endif; ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • try a diff name for ‘page-header’.

    Thread Starter staceyzav

    (@staceyzav)

    OK, thanks – but it was working even with that name (but I guess that is a bad idea for a name), I just don’t want it to show up on the homepage. I need to add something like: if ( !is_home() ) somewhere, just not sure where to add it.

    so if I change the name of the sidebar to topbar – where can I add my conditional statement to get it to not appear on the home page.

    <?php /* Widgetized sidebar */
        if  (!function_exists('dynamic_sidebar') || !dynamic_sidebar('topbar') ) : ?><?php endif; ?>

    Thanks!

    Above is not a full Page Template, please use Pastebin or if short (less than a 1000000000000000000 lines – kidding! less than 10?) post your full Page Template.

    Thread Starter staceyzav

    (@staceyzav)

    Unfortunately, I don’t have the full page template. I’m using Genesis framework to build my theme, so I’m just adding a “simple hook” through the wp dashboard so I can add an additional sidebar to every page except the homepage. The statement above is a good start as does what I want it to do (adds a sidebar), except I’m trying to figure out how to exclude it from the homepage.

    So basically I’m just looking for a conditional statement that says the following:

    • add sidebar (named topbar) unless you are on the homepage

    Does that help!?

    Thanks for your help either way!

    EXCLUDES this particular sidebar from the homepage

    try using a conditional tag http://codex.wordpress.org/Conditional_Tags

    either is_home() or is_front_page():

    example to replace your code (untested):

    <?php /* Widgetized sidebar */
        if ( !is_home() ) dynamic_sidebar('topbar'); ?>

    for specifics, please contact the theme’s developer.

    Thread Starter staceyzav

    (@staceyzav)

    That works perfectly – thanks so much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘conditional sidebar’ is closed to new replies.