WordPress.org

Ready to get started?Download WordPress

Forums

How-to: Add Sidebar to Post Pages in WP2 Default Theme (4 posts)

  1. jpozadzides
    Member
    Posted 8 years ago #

    How to add a sidebar to the individual post pages in the default WP2 theme.

    I had the desire to add the sidebar to the individual posting pages for two main reasons.

    1) If my visitors navigated into the site and then couldn't figure out how to get back to the home page they might bail out.
    2) If a search engine brought visitors to a particular page I wanted them to be able to further explore the site from there.

    Turns out it was EXCEPTIONALLY easy to do this.

    All you need to do is edit 'single.php' as follows:

    Change the second line which currently reads:
    <div id="content" class="widecolumn">
    To have a class="narrowcolumn">

    THEN

    Add the following line just before the last line on the page (before <?php get_footer(); ?>):
    <?php get_sidebar(); ?>

    Now pop open a cold one and admire your handy work.

    Have fun,

    John P
    http://pozadzides.com/john/blog/

  2. moshu
    Member
    Posted 8 years ago #

    Or you could use the Kubrick 1.5 - AllSidebar Edition from the Codex: Themes#Two_Columns ;)

  3. xhale
    Member
    Posted 8 years ago #

    The all sidebar edition is great, except when you're not a php/css/html guru and you've already done a week and a half's worth of custom modifications to the existing Kubrick theme. Mine is now far more of an easy-CMS than a blog. I've removed even the ability to comment on posts, no trackbacks or blogrolls, I've searched and replaced every instance of the word "blog" I could find, etc.

    I came here looking for this EXACT information.

    Thank you very much, John. After all the work I've done to -limit- my WP install's functionality, you've saved me hours worth of work on adding one feature.

  4. Starbuck
    Member
    Posted 8 years ago #

    John, thank you so much. I'm a new WP user and this page was irritating me.

    About allowing the user to get back to the homepage, I found the blog name in the Kubrik header is a link to the home page. But I also wanted something more obvious, so I modified the sidebar.php as follows:


    <!-- This goes after the commented out
    <li>authorblock</li>
    at the top of the code.-->
    <?php /* If this is not the front page */
    if ( !is_home() || is_page() ) { ?>
    <p align="center">
    <a href="<?php bloginfo('home'); ?>/">
    Return to <?php echo bloginfo('name'); ?>Home
    </a>
    </p>
    <?php /* /Starbuck */ } ?>

    Hope that helps someone.

Topic Closed

This topic has been closed to new replies.

About this Topic