Under ‘News’ category I have modified the sidebar so that it only shows posts under this category. Great.
Problem: When I click on a news article it brings me to its single page but the sidebar changes.
How do I display category-related posts in the the Single Template (single.php)?
Is it possible to do something like the following in the single template?
if is_category ‘news’ -> my_news_sidebar.php
else -> sidebar.php
I’ve searched in Google and looked in the documentation to no avail. For some reason I can’t get this apparently easy thing to work. Thanks in advanced.
- The topic ‘How-to: Get category related posts in Single template’s sidebar’ is closed to new replies.