Hi I have some trouble constructing a variable sidebar.
On my theme I use a variable sidebar that displays all the posts. On the homepage it displays all the posts, on the category archive it displays the posts of that category. So far all good.
My problem now is that when I am in the category template and I click on a post, my sidebar relinks me to my index.php file by which the selection in the sidebar is lost. It should keep that selection of the category archive – but WordPress links to the single.php file. How can I force the sidebar to either stay in the category archive or retain that selection?
Here is my code for the sidebar:
<?php
if ( is_category('editie') ) {
include 'sidebar-cat-editie.php';
} elseif ( is_category('publicatie') ) {
include 'sidebar-cat-publicatie.php';
} elseif ( is_category('tentoonstelling') ) {
include 'sidebar-cat-tentoonstelling.php';
} else {
include 'sidebar.php';
}
?>
Basically I would need something like wordpress/archive/category/single
I know this does not exist, but how can I tell my sidebar that if the single.php is reached from a category archive it should retain that specific sidebar for the categoyr archive?
Any help is welcome, even just a simple direction.