Network theme – Add sidebar to homepage

Hi can someone tell me how to add a sidebar to the homepage similar to single post layout?

  • Philip John
    • DEV MAN’s Apprentice

    Hiya!

    In order to place a sidebar on to the home page you will need to edit the theme yourself as the home page doesn’t include a sidebar as standard.

    To do this, you will need to add <?php get_sidebar(); ?> into home.php. Note however, that this is likely to look messy and there’ll be some significant work needed to the stylesheet to make it fit.

    Hope this helps.

    Cheers!

    Phil

  • Reggie77
    • Flash Drive

    My home.php file shows the following:

    <?php get_header() ?>

    <div class=”page wideColumn” id=”content”><!– start #content –>

    <div class=”padder”>

    <?php locate_template( array( ‘/library/components/feature-content.php’ ), true ); ?>

    </div>

    </div><!– end #content –>

    <?php get_sidebar(‘blog’:wink:; ?>

    <?php get_footer() ?>

  • Tammie
    • WordPress Wizard

    You are missing a few things at the start which would help. Lets recap…

    You need to look at single.php for a starting guide inbetween header / footer calls you see this:

    <div id="container-background">
    <div id="content"><!-- start #content -->
    <div class="padder">
    <div class="page wideColumn" id="blog-latest"><!-- start #blog-latest -->
    <?php if($bp_existed == 'true') : ?>
    <?php do_action( 'bp_before_blog_single_post' ) ?>
    <?php endif; ?>
    <?php if (have_posts()) : ?>

    <?php if( $bp_existed == 'true' ) { ?>
    <?php bp_wpmu_singleloop(); ?>
    <?php } else { ?>
    <?php wpmu_singleloop(); ?>
    <?php } ?>

    <?php if($bp_existed == 'true') : ?>
    <?php do_action( 'bp_after_blog_single_post' ) ?>
    <?php endif; ?>
    <?php endif; ?>
    </div> <!-- wideColumn -->
    </div>
    </div><!-- end #content -->
    <?php get_sidebar('blog'); ?>
    <div class="clear">
    </div>

    So we can use that as a ‘template’ so to speak. The key is:

    <div class="page wideColumn" id="blog-latest"><!-- start #blog-latest -->

    So…

    <div id="container-background">
    <div id="content"><!-- start #content -->
    <div class="padder">
    <div class="page wideColumn" id="blog-latest"><!-- start #blog-latest -->
    <?php
    locate_template( array( '/library/components/feature-content.php' ), true ); ?>
    </div> <!-- wideColumn -->
    </div>
    </div><!-- end #content -->
    <?php get_sidebar('blog'); ?>
    <div class="clear">
    </div>

    BUT.. one thing not said here is the impact this may have on the CSS you are using for the grid. Be sure to consider change that too.

    Use single.php as the ‘base’ and you’ll easily be set.