I have two sidebar widgets, I need to display 1 widget on the archive pages for the standard post categories and the other widget needs to show on just the archive pages for a specific custom post type.
If I use the conditional tag is_archive() then both widgets will show up on both archive pages.
How can I determine which archive page the widgets should be displayed on?
I'm using the plugin 'Widget Logic'
Thanks in advance
I have two sidebar widgets, I need to display 1 widget on the archive pages for the standard post categories and the other widget needs to show on just the archive pages for a specific custom post type.
If I use the conditional tag is_archive() then both widgets will show up on both archive pages.
How can I determine which archive page the widgets should be displayed on?
I'm using the plugin 'Widget Logic'
Thanks in advance
Share Improve this question asked Aug 16, 2012 at 10:36 BradBrad 11 bronze badge2 Answers
Reset to default 2You could use the is_tax() function to accomplish this.
The first parameter, the taxonomy slug is optional, but you do want to specify it. This would be something like product-categories
. The second, a specific term, is also optional. It'd be perfectly acceptable to have the following:
is_tax('product-categories');
(is_archive()&&(get_post_type()=='projects'))