最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

conditional tags - Display a widget on a specific type of archive

programmeradmin5浏览0评论

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 badge
Add a comment  | 

2 Answers 2

Reset to default 2

You 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'))

发布评论

评论列表(0)

  1. 暂无评论