Wordpress 获取当前类别 ID [英] Wordpress getting current category ID
本文介绍了Wordpress 获取当前类别 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试获取我正在查看的类别页面的当前 ID.
I'm trying to get the current ID of the category page I'm viewing.
我检查了the_category_ID
但是当我使用时,这与我的结果相呼应
But this echo'd my result when I used
<?php $catID = the_category_ID(); ?>
有没有办法让它将值返回给变量以使其隐藏?
Is there a way to get it to return the value to the variable so its hidden?
推荐答案
这会写入变量而不是回显
This writes the variable instead of echoing
<?php $catID = the_category_ID($echo=false);?>
这篇关于Wordpress 获取当前类别 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文