Support » Fixing WordPress » Multiple Sidebars – One for blog, one for site

  • Resolved rockstarpoet

    (@rockstarpoet)


    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?

Viewing 6 replies - 1 through 6 (of 6 total)
  • moshu

    (@moshu)

    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!

    rockstarpoet

    (@rockstarpoet)

    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.

    moshu

    (@moshu)

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

    rockstarpoet

    (@rockstarpoet)

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

    Thanks. I’ll buy you a chocolate sundae next time I see you 🙂

    moshu

    (@moshu)

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

    rockstarpoet

    (@rockstarpoet)

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Multiple Sidebars – One for blog, one for site’ is closed to new replies.