Unique sidebar for each subcatagory on archive.php
-
On archive.php, I would like to have a unique sidebar (branch) displayed for each subcategory of the News category.
The subcategory IDs are being identified in if statements before the parent News category (ID 408).
The News category uses a unique sidebar (news). The if statement (in_category, is_category) I attempt to use in archive.php for the subcategories seems to be ignored. Instead, the News category sidebar (news) displays.
<?php $post = $wp_query->post; if (is_category(array('3826','13684'))) { get_sidebar(learning); } elseif (is_category('676')) { get_sidebar(org_transform); } elseif (is_category(array('2048','2979','3447','3835','16788','16821','16822','16824','16826','16827','16828'))) { get_sidebar(branch); } elseif (is_category(array('408','news'))) { get_sidebar(news); } else { get_sidebar(); } ?>
Might this be caused by the permalink displaying /news/subnews-category1/ instead of /subnews-category1/?
I am successful in loading a unique banner for each subcategory in header.php, but don’t understand why the sidebar is being difficult.
Is there a solution — other than moving the subcategories into their own categories?
- The topic ‘Unique sidebar for each subcatagory on archive.php’ is closed to new replies.