Support » Themes and Templates » Blix, seperate sidebar for each page

  • Resolved neiloughton


    Hi guys,

    Ive been using the Blix theme for a while now, i have it fairly customised to show the sidebar at every opportunity.

    My question is. Does anyone have it configured so that:

    on my about page i could have “about” info in the sidebar.
    on the contact page i could have “contact” info in the sidebar.
    Then on posts, comments and archives i could have whats already there.

    I guess what im asking is, is it possible to have a differnt side bar content per page?

    Cheers in advance,


Viewing 15 replies - 1 through 15 (of 16 total)
  • Yes it is… first you need to create page templates for each type of page you want, then you need to call in a customized sidebar for that page…

    for example, take your default page template and rename it “contact.php” – taking care to change the template name at the top to “contact”

    then take the sidebar, and save a copy as “contactsidebar.php” – change whatever info in it that you want, and then go back to the new template page you just made, and replace the “sidebar.php” with “contactsidebar.php”

    and replace the “sidebar.php” with “contactsidebar.php”

    That will not work, I mean if you change the regular
    get_sidebar into get_contactsidebar.
    You will have to use an include.
    On the other hand, you can just make one huge sidebar with a lots of if_statements.

    Between the examples you two have given, is there a clear way of doing things?

    I thought of making several sidebar files, but its how to call them correctly.

    That’s the easy part:
    <?php include (TEMPLATEPATH . '/yoursidebarname.php'); ?>
    Don’t change anything else, just the sidebars’ filename.

    Thats great Moshu, but according to the blix structure, there is only one page file, im not sure how to make the pages independant of one another.

    You mean page.php template file? Some themes don’t have even one 🙂
    You can create as many Page templates as you want. Check out the Codex at the link above.

    “That will not work, I mean if you change the regular
    get_sidebar into get_contactsidebar.
    You will have to use an include.”

    I don’t recall saying changing get_sidebar to get_contactsidebar… I DO recall saying change the filename from sidebar.php to contactsidebar.php by saving a copy of sidebar.php AS contactsidebar.php (I thought it would’ve been fairly easily understood that this would have to be under the include as opposed to using “get_” – which is why I didn’t USE the “get_” format)

    neil – you have to save the page template file as whatever other template files you want. then you have to save the sidebar files as whatever other sidebar files you want. then you have to go back to the proper template file, and INCLUDE the proper sidebar file.

    I have made new page templates so each page has its own template. I have then created a new sidebar for each page…

    aboutsidebar.php etc….

    Then used your include to call it.

    Works perfectly!

    nice to hear neil 🙂

    Yeah defo…

    Ive setup four files:


    Each page calls in the matching sidebar file. Then underneath the line (in the Blix theme) sidebar duplicates:

    <?php if (is_page () && !is_page(“archives”)) { ?>

    you add content underneath for that page.

    Simple when you know how eh? Thanks again.

    neil – the funny thing is that i JUST went and figured it out on my own (i’m NOT a php whiz by any means, but learning WP has helped me a lot) – and have spent the greater part of the past two days doing this to one of my own sites for not 1, not 2, but 6 additional page templates… lol

    at least i got to help someone else by learning it myself – now you can too – that’s the best thing about these forums!

    I may be a little late on this topic, but for my site I have one “big” sidebar with conditional statements for when to include whatever. This works better for me because there may be things I may want on more than one page, but not all (like an archive calendar). If I made seperate templates for each page I’d be duplicating this code (unwise), unless I want to make EVERY item in my sidebar its own little file and include them as necessray in the multiple templates (sounds like a mess).

    “unless I want to make EVERY item in my sidebar its own little file and include them as necessray in the multiple templates (sounds like a mess).”

    Not a mess at all – this is what I did in a matter of an hour or so, and now am just going in and tweaking what I want on each sidebar.

    I know what you mean about having the one “big” sidebar, however it truly depends on what it is you’re looking to have there. For example, hard-coded stuff like client testimonials or screenshot thumbnails or maybe even contact information… it’s a little more than just calling in functions. And everyone knows that large file sizes slow the loading of your site, which is terrible for SEO purposes. (Okay, maybe not everyone knows that – but I do, since I’m an SEO specialist.)

    So I find it much neater and more organized to call in a specific sidebar to a specific page template depending on the topic of the page or sub-pages. That way I don’t have to go hunting through a “big” file to find something I want to change out or tweak.

    I decided on the seperate sidebar idea specifically for the blix theme…I guess it depends on what your using.

    ladydeluna :: Yeah, your way is definitely more than workable. I think the mess I was referring to would be having twenty little php files running around my theme folder (I know it woulc be cleaned up… but). For me it was just easier to put conditionals in a larger file.

    Oh, and don’t forget, since the conditionals are php the entire sidebar file doesn’t get sent to the browser… just what was conditionally included. 🙂 (I think)

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Blix, seperate sidebar for each page’ is closed to new replies.