How to Display Different Sidebar for Each Post or Page in WordPress

In this article you’ll learn how to display different sidebars for each post and page in WordPress.

This comes in very handy if you want to show a different side bar for your pages versus your posts and even if you want to show a specific sidebar for say one of your popular posts on your website.

So to do that let’s head over to our WordPress dashboard and we need to head over to our plugins area, we’ll click add new.

We’ll be adding a new plugin to our website. So we’re searching for easy custom sidebars.

This is the one we want,  so go ahead and click install now

and once that’s installed let’s make sure we activate it.

This plugin can be handled under Appearance, Theme Sidebars.

From here you want to create a new sidebar.  So we’ll name it.

Since it’s the sidebar for pages

we’re going to add the pages area here

and we need to scroll down, we want to make sure that we replace sidebar which is the default sidebar that we have with this

and we’ll click Save sidebar.

So we have that let’s head over to our Widgets area

because we want to set it up on what we want to show for it. So the sidebar for pages is empty, normal sidebar will show the search, our sidebar for pages we want to show categories

and archive.

We’ll save those items

 

and now we’ll visit the site and see it in action and you see on our home page. We have the default search like that but when I click on our About Us page,

Now we see categories and because it’s fairly long.

I’ll scroll down and you see archive

and the great thing about that is you can get as granular as you want. To show you what I mean let’s head back over to set theme sidebars area.

We’ll create a new sidebar

We’ll name it

 

and you probably want to know what the popular post is. Let’s say that  MonsterLinks two step up in technology posts is our most popular post.

So we’ll click Add to sidebar

 

and what we want to do is replace this one with our new one. Let’s save the sidebar

Now we need to fix the widget area for just that post. For this popular post we’re going to add an image

and we want to add recent comments.

Now let’s see it in action. When I go back to my website find the MonsterLinks two step opt-in,

we have recent comments as our sidebar

and when we go back to our homepage we still have the search and then when we go to our about us we have the different category sidebar.

So this is a great way to showcase specific information based on where the user is on your site.

Читайте также:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *