WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple Sidebars - One for blog, one for site (7 posts)

  1. rockstarpoet
    Member
    Posted 7 years ago #

    Hello,

    I am using WP 2.2 and Chris Pearson's CopyBlogger theme. I am setting a site where the blog is NOT the main page. I would like to have a sidebar for the site, because I don't want recent posts, comments, etc showing up all over the site and then a sidebar for the blog with the aforementioned options.

    Here is what I tried. It couldn't be this easy though, could it :). I uploaded a second sidebar.php but changed the name to blog_sidebar.php. I changed the div class to the same on that file. I then went to the Index.php (which is what the blog is based out of, correct?) and changed the php get from sidebar.php to blog_sidebar.php.

    On the page I got a fatal error in the sidebar and in the footer.

    What am I missing?

  2. moshu
    Member
    Posted 7 years ago #

    It works the other way around...
    get_sidebar (and get_header & co.) are functions defined in the WP engine (core files) so, don't change them!
    To call different custom template files that reside in your theme directory, use this:
    <?php include (TEMPLATEPATH . "/yourfilename.php"); ?>
    Use it as it is, just change the filename!

  3. rockstarpoet
    Member
    Posted 7 years ago #

    As I was doing it I thought... There's no way it's going to be this easy. But it worked like a charm! Thanks so much!

    One question though... It's loading my modified sidebar and the original. I hope I am not pushing my luck for help, but I would really appreciate it.

  4. moshu
    Member
    Posted 7 years ago #

    It means you have the call for both: the code I gave above AND the get_sidebar. Delete one.

  5. rockstarpoet
    Member
    Posted 7 years ago #

    Yes, I suppose that should have been a bit obvious, huh.

    Thanks. I'll buy you a chocolate sundae next time I see you :)

  6. moshu
    Member
    Posted 7 years ago #

    You never know... Calgary is just one day drive from Winterpeg!

  7. rockstarpoet
    Member
    Posted 7 years ago #

    Let me know. Peter's (infamous Calgary ice cream shop) is only a couple blocks away. ;)

Topic Closed

This topic has been closed to new replies.

About this Topic