Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Different sidebar for home and posts page WordPress Re: Different sidebar for home and posts page WordPress

#71396
TheDoc
Member

The home page will use the template "index.php". A post’s page will use "single.php".

First you need to decide how many types of pages each sidebar will appear on. For example, if the sidebar on the homepage is ONLY going to be seen on the home page (not on a category page, blog page, single page, post page, etc etc) then do the following:

1. Duplicate your sidebar.php and give it a new name (like, sidebar-home.php).

2. Open up your index.php and find

Code:

and replace it with

Code:

3. Open up your sidebar.php and edit it to show what you want on single.php, category.php, etc etc.

If the sidebar on the homepage is going to be used elsewhere in the site, then you’re going to want to do the opposite of above:

1. Create a new sidebar.php and give it a new name (like, sidebar-single.php) and edit it to only show what you want to see on a post’s page.

2. Open up your single.php and find

Code:

and replace it with

Code:

That was sort of weirded confusingly, but I hope you get the idea.