How do I create a custom sidebar that only lists posts from current category
-
I would like to create a custom sidebar so that the sidebar menu only displays a list of post titles from the current parent category (not the post titles from other categories). It would also display a list of all other categories but not the titles of their posts.
So for example if I’m currently viewing a post from category two it only displays the list of all posts from that current category like the following:
Category one
Category two
– Child category two (post 1)
– Child of category two (post 2)
– Child of category two (post 3)
– Child of category two (post 4)
– Child of category two (post 5)
Category three
Category four
Category five
Category sixIf I’m viewing a post from category four it only displays the post titles under that category like so:
Category one
Category two
Category three
Category four
– Child category four (post 1)
– Child of category four (post 2)
– Child of category four (post 3)
– Child of category four (post 4)
– Child of category four (post 5)
Category five
Category sixWhich file would I edit and if you could provide the code that would be much appreciated.
Thanks
- The topic ‘How do I create a custom sidebar that only lists posts from current category’ is closed to new replies.