Support » Themes and Templates » Making sidebar different on index vs. post pages

  • Hi all,

    Currently my sidebar appears on every single page of my WP blog, and it’s the same on each page. I’m wondering if it’s possible to have 2 sidebars – one for the “main” page of my blog, and a different one for the post pages. The only thing I’ve seen so far when I’ve searched on this topic is how to remove the sidebar completely, and I don’t want to do that. I just want to display a few MORE things on my “main” page sidebar that don’t need to be on the post pages and such.


Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve never tried it, but in wp/wp-includes/general-template.php
    is the function “get_sidebar”

    I would imagine it’s possible to create another function here, and call it “get_sidebar2” or something, only have it point to another sidebar, like sidebar2.php.

    You would have to create the sidebar2.php in your current theme’s folder.

    Then wherever you want sidebar2.php to appear call the function you created called “get_sidebar2”. Be sure and style it appropriately. Probably the same as the first sidebar.

    Remember, though that you would be hacking core WP files, and it would be advisable to back everything up.

    I’m sure there’s an easier way to do it, but that’s the first thing that came to mind…

    I’d be interested to know how to properly do this as well.

    Or just use the is_home() function in your existing sidebar.php file to conditionally output stuff.

    There is a solution in this thread from three days ago

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Making sidebar different on index vs. post pages’ is closed to new replies.