I am calling this code from my custom sidebar, in order to get related postings from the same category:
query_posts(array( 'cat' => get_category_id(), 'showposts' => 5, 'post__not_in' => array(get_the_ID()) )); get_template_part('article-list'); // outputs the posts
This works. The
have_posts()-loop inside of my article-list.php now only outputs 5 other postings from the category.
But this also causes a problem: No matter on what kind of page I am (single.php, index.php, ...), WordPress always assumes that I am in the category template. So
is_category() always returns
true after calling
false, although the single.php-template is used.
What can I do to tell WordPress that it is still using the single-template? Or: What other function can I use to detect which (main) view is loaded?