检查当前页面是否是wordpress中的类别页面? [英] Check if current page is category page in wordpress?
本文介绍了检查当前页面是否是wordpress中的类别页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果当前页面是类别页面,我必须插入一些条件.
解决方案
我找到了解决方法,方法是检查 $cat_id
在该页面上是否可用,方法如下.
>
$cat_id = get_query_var('cat');
现在我们可以检查 $cat_id 是否可用,那么它是一个类别页面,否则它不是.
I have to insert some condition if the current page is a category page or not.
解决方案
I have found the way to do it by checking if $cat_id
is available or not on that page by the following.
$cat_id = get_query_var('cat');
Now we can check if $cat_id is available then it is a category page otherwise it is not.
这篇关于检查当前页面是否是wordpress中的类别页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文