WordPress.org

Forums

[resolved] code to suppress sidebar on homepage (2 posts)

  1. scormeny
    Member
    Posted 8 years ago #

    I'm using a theme I developed myself. I am using the "static home page" plugin. I want the sidebar to appear on every page BUT the home page. I'm not a programmer, so I think my PHP skills are not up to snuff for this.

    In the page.php template, the "get_sidebar" call is working fine.

    I'm trying to alter my sidebar.php file so that nothing will be displayed if it's the home page, and the entire sidebar will be displayed if it's any other page. My current sidebar.php looks like:

    <?php if (is_home()) { ?>
    echo "";
    <?php } else { ?>
    <div id="sidebar_content">
    <!-- WPG2 Image Block Coding -->
    <?php print g2_sidebarimageblock(); ?>
    <!-- end WPG2 Image Block Coding -->

      <!-- EventCalendar Coding -->
      <?php _e('Shows & Class Schedule'); ?>
      <?php ec3_get_events(5); ?>
      <!-- end EventCalendar Coding -->

    </div>
    <?php } ?>

    I'd be most appreciative of any advice!

    You can see my site, which is under construction, at http://www.mikesouthern.com/wp/

  2. scormeny
    Member
    Posted 8 years ago #

    I discovered that I had to fix two things.

    First, the line that includes echo ""; had to be enclosed in php tags.

    Second, I had to disable the wp-cache plugin, which was preventing me from seeing my changes.

    Now, my code appears to be working.

    That seems to be it; hope this is helpful to someone else.

Topic Closed

This topic has been closed to new replies.

About this Topic