• emetelko

    (@emetelko)


    I am having a problem getting my sidebar to not show on my ‘home’ page. I have gotten it to show on my other pages but I want to exclude it from just my homepage. I have tried conditional tags, but I am no expert and might not be adding them in the right place. Also I haven’t seen this dynamic sidebar coding very many places. Please help!

    The code for the current sidebar in my page.php file is:
    <!– subcontent …………………………… –>
    <div id=”subcontent”>
    <?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar() ) : else : ?>
    <?php endif; ?>

    </div> <!– /subcontent –>

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I’d replace it with this:

    <div id="subcontent">
    <?php if (!is_home() && function_exists('dynamic_sidebar')) {
    dynamic_sidebar();
    } ?>
    </div>
    Thread Starter emetelko

    (@emetelko)

    That didn’t seem to do anything…any other ideas?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    … What do you mean it didn’t do anything? You did something wrong if that code didn’t work.

    Are you using any sort of cache, like WP-Super-Cache? Clear the cache to see changes if you are.

    Thread Starter emetelko

    (@emetelko)

    I obviously am doing something wrong b/c when I plug that into my page.php file the sidebar still exists in the home page. I have even tried changing the actual sidebar.php file to include that code. And vice versa. My page URL is http://blog.whateverymerchantshouldknow.com/

    My page.php file now reads:<?php get_header(); ?>

    <!– subcontent …………………………… –>
    <div id=”subcontent”>
    <?php if (!is_home() && function_exists(‘dynamic_sidebar’)) {
    dynamic_sidebar();
    } ?>
    </div> <!– /subcontent –>

    <!– content …………………………… –>
    <div id=”content”>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <h2><?php the_title(); ?></h2>

    <?php the_content(); ?>
    <?php wp_link_pages(); ?>
    <?php $sub_pages = wp_list_pages( ‘sort_column=menu_order&depth=1&title_li=&echo=0&child_of=’ . $id );?>
    <?php if ($sub_pages <> “” ){?>
    <p>Sub Pages Found</p>

      <?php echo $sub_pages; ?>

    <?php }?>

    <?php endwhile; ?>

    <?php endif; ?>

    <?php comments_template(); ?>
    </div> <!– /content –>

    <?php get_footer(); ?>

    And the sidebar.php file reads: <hr class=”low” />

    <!– subcontent …………………………… –>
    <div id=”subcontent”>
    <?php if (!is_home() && function_exists(‘dynamic_sidebar’)) {
    dynamic_sidebar();
    } ?>

    <?php /**
    * Pages navigation. Disabled by default because all new pages are added
    * to the main navigation.
    * If enabled: Blix default pages are excluded by default.
    *
    ?>
    <h2>Pages</h2>
    <ul class=”pages”>
    <?php
    wp_list_pages(‘title_li=&sort_column=menu_order’);
    ?>

    <?php */ ?>

    <?php if ()?>
    <h2>Categories</h2>

    <ul class=”categories”>
    <?php
    if (function_exists(‘wp_list_categories’))
    {
    wp_list_categories(‘title_li=’);
    }
    else
    {
    wp_list_cats(‘optioncount=0&hierarchical=0’);
    }
    ?>

    <h2>Links</h2>

    <ul class=”links”>
    <?php get_links(‘-1’, ‘

    • ‘, ‘
    • ‘, ”, 0, ‘name’, 0, 0, -1, 0); ?>

      <h2>Feeds</h2>

      <ul class=”feeds”>

    • “>Entries (RSS)
    • “>Comments (RSS)
    • <?php } ?>

      <?php if (is_single()) { ?>

      <h2>Calendar</h2>

      <?php get_calendar() ?>

      <h2>Most Recent Posts</h2>

      <ul class=”posts”>
      <?php BX_get_recent_posts($p,10); ?>

      <?php } ?>

      <?php if (is_page(“archives”) || is_archive() || is_search()) { ?>

      <h2>Calendar</h2>

      <?php get_calendar() ?>

      <?php if (!is_page(“archives”)) { ?>

      <h2>Posts by Month</h2>

      <ul class=”months”>
      <?php get_archives(‘monthly’,”,”,’

    • ‘,’
    • ‘,”); ?>

      <?php } ?>

      <h2>Posts by Category</h2>

      <ul class=”categories”>
      <?php wp_list_cats(‘sort_column=name&hide_empty=0’); ?>

      <?php } ?>
      <?php endif; ?>

      </div> <!– /subcontent –>

      Thanks so much:)

    Worked for me. Thanks Otto42!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need to exclude sidebar from homepage: Dynamic Sidebar’ is closed to new replies.