I have my solution for custom sidebars on my pages and my individual posts. But now, I'm trying to find the solution for archives and categories.
I have this in my page php file for pages where 2 is the page id# and sidebar2 is the custom sidebar I have for that one page:
<?php if (is_page('2')) : ?> <?php get_sidebar('sidebar2'); ?> <?php else : ?> <?php get_sidebar(); ?> <?php endif; ?>'
I have this in my single post php file for posts where 100 is the post id# and homepage is the custom sidebar I have for that one post:
<?php if (is_single('100')) : ?> <?php get_sidebar('homepage'); ?> <?php else : ?> <?php get_sidebar(); ?> <?php endif; ?>
But, I am now wondering what the code is to target specific pages for archives and categories?
Please note, I do not want to specify the entire archive nor the entire category; I'm looking to specify each individual "page" of the archives and categories.
For example, if I have website.com/category/communication/page/4 or website.com/category/communication/communication-series/page/3 as the url, how do I target each "page" specifically?
Basically, no matter where/when Article A appears, I want one and only 1 specific sidebar for only Article A; and then no matter where/when Article B appears, I want one and only 1 specific sidebar for only Article B where the sidebar for Article A appears nowhere else but Article A, etc.
I am aware of the is_archive() function, but according to this Codex article, "...is_archive() does not accept any parameters..."
I am also aware of this conditional tags codex article, but the category slug isn't working for my purposes (probably because of the url structure as referenced above) and the archive information of this Codex article leads me back to the first codex article I linked to that states 'it doesn't accept parameters'.
Please note that I do not want to use a plugin for this.
I am also an incredible newbie to code, so I'm asking for specifics and code examples as much as possible.
Thanks in advance for any information you can provide!