Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

Welcome to WP Stack Exchange! You could use the is_tax() function to accomplish this. Thanks!

share|improve this answer
    
Thank you so much for your reply. The problem I have is that the non standard archive pages are for a custom post type of 'Product' and the categories related to the products can be added frequently so I would need to update the code each time a new product or category is added. Is there anyway I can just add one widget to the standard archive pages and then one widget to the archive pages for the custom post type of product? –  Brad Aug 16 '12 at 15:22
    
Hi - the first parameter, the taxonomy slug is required - so this would be something like product-categories. The second, a specific term, is optional, so it'd be perfectly acceptable to have: is_tax('product-categories') –  Zach Aug 16 '12 at 15:57
    
Sorry - first parameter is also optional, but that's where you would specify your taxonomy slug. Thanks. –  Zach Aug 16 '12 at 16:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.