WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple Sidebars (6 posts)

  1. aprilia
    Member
    Posted 8 years ago #

    Is this possible? I would like to have a 'standard' sidebar on the home page and a separate one with a google ad-block on the 'single' page that is the entire article. I have copied and modified that sidebar.php file and saved it as sidebar_single.php. I changed the "get_sidebar" callout to "get_sidebar_single" and got an "undefined function" error.

    Where (ugh - and how) do I define the function?

    I am a php newb. I have a php manual that I am reading at the moment, but would like to know if this is reasonably simple or not. I am using the cleanbreeze theme.

    http://motorcyclebloggers.com

    Thanks.

  2. Chadwick
    Member
    Posted 8 years ago #

    "get_sidebar" is refering to the php function that calls the file "sidebar.php"
    What you need to change is the function or make a new one that calls your new file as a sidebar...
    I haven't actually checked this out but from my current knowledge you would have to find out which wordpress file the function "get_sidebar" is in then either copy that and make a new function to call or to rename it to call your other sidebar.

    Hope this helps..

  3. tomhanna
    Member
    Posted 8 years ago #

    Chadwick is close, but you don't need to modify any core files. You just need to follow the instructions in the Codex for Include Tags, specifically for "Including Any Template" on that page.

    http://codex.wordpress.org/Include_Tags

    If "sidebar_single.php" is in your theme directory, you should be able to use

    <?php include (TEMPLATEPATH . '/sidebar_single.php'); ?>

  4. aprilia
    Member
    Posted 8 years ago #

    I will try that tonight.

    Thanks a bunch to the both of you!

  5. aprilia
    Member
    Posted 8 years ago #

    Worked like a charm. Thanks!

  6. greeny
    Member
    Posted 8 years ago #

    can someone please tell me what i am doing wrong? i've followed every instruction about multiple sidebars in the support forum and codex lessons and it STILL does not work for me. clearly i have no idea what i am doing.

    i've inserted the
    <?php include (TEMPLATEPATH . '/sidebar_about.php'); ?> onto my about.php file and it doesn't do anything no matter where it is placed.

    <?php
    /*
    Template Name: About
    */
    ?>

    <?php get_header(); ?>

    <div id="content" class="widecolumn">

    </div>
    <?php include (TEMPLATEPATH . '/sidebar_about.php'); ?>
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.