方法1、变量$cat,只能在分类页使用 。

方法2、global $wp_query; $cat_ID = get_query_var('cat'); 获取当前分类ID号,只能在分类页使用。

方法3、在page单页面使用:

$cat=[......]

阅读全文