Further explanation of what I’m doing.
The blog only has 3 categories. My conditional statement accomplishes this:
If it’s category n, the sidebar gets recent posts from only that category (using customizable-post-listings plugin).
All 3 category links remain there hard coded, so it’s like an expanding menu.
In the same if statement I added, OR if it’s a post in category n (using php from the codex to use in_category outside the loop).
My main page (using Page to Front plugin) is getting caught by being a post in category 1, + I’m unable to catch it in an elseif statement for is_page, or the final else statement, which shows recent posts from all 3 categories. Everything else works great.
<?php $post = $wp_query->post; ?>
<?php if ((is_category(1)) || (in_category('1'))) { ?>
category 1 link
get recent posts from category 1
category 2 link
category 3 link
<?php } elseif ((is_category(2)) || (in_category('2'))) { ?>
category 1 link
category 2 link
get recent posts from category 2
category 3 link
<?php } elseif ((is_category(3)) || (in_category('3'))) { ?>
category 1 link
category 2 link
category 3 link
get recent posts from category 3
<?php } elseif (is_page()) { ?>
category 1 link
get recent posts from category 1
category 2 link
get recent posts from category 2
category 3 link
get recent posts from category 3
<?php } else { ?>
category 1 link
get recent posts from category 1
category 2 link
get recent posts from category 2
category 3 link
get recent posts from category 3