Get a free trial // Grow your CSS skills // Land your dream job

Different sidebar on only my blog page using wordpress

  • # January 28, 2010 at 11:47 am

    Hi folks.
    I am trying to get a different sidebar to appear only on my blog page.

    I am using wordpress as a CMS for the whole site and have static pages everywhere except my blog post. I know the problem is probably due to the fact that wordpress doesn’t recognize the blog page as a "page" but treats it differently.

    I have tried making a new page template (blog.php) and a new sidebar (blog_sidebar.php) and copying and pasting my index.php text into the blog.php and changing the get_sidebar.php accordingly, but it doesn’t work at all for my blog section.

    If anyone could point me in a direction to fix this I would greatly appreciate it.

    Also, I am developing this site on a localhost so I don’t have any site to point you to in order to see what I am talking about.

    # January 31, 2010 at 4:00 pm

    It’s a little hard to figure out exactly how you’re setup right now, but I think what I would do is something like this:

    < ?php if( is_page() ): ?>

    < ?php else: ?>
    < -- Blog sidebar code here -->
    < ?php endif; ?>
    # January 31, 2010 at 6:33 pm

    thanks for the reply Josh-the code isn’t working for me though.

    I guess to simplify my question I will just ask this…

    Is it possible for a wordpress CMS site to have a different sidebar for a static homepage and for the posts page?

    It doesn’t seem possible to me, but I am sure there is a way

    # February 9, 2010 at 4:07 pm

    Your best bet is to setup different page templates and use different sidebars on the different templates. It also depends how the sidebar is setup in your theme though.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed