<table class="PHP">
<tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 自定义的需要使用get_the_terms * in_category 只有父级分类有这个功能,子分类没法调用 解决方法:添加 post_is_in_descendant_category 函数到模板 -------------实验未证明 // Post is assigned to "fruit" category or any descendant of "fruit" category? PHP in_category post_is_in_descendant_category 。。。 ********************************************************************** 使用slug: if ( $category_to_check = get_term_by( "name","fruit","category" )) post_is_in_descendant_category($category_to_check->term_id); ref:http://www.sjyhome.com/wordpress/in_category.html#Testing_if_a_post_is_in_a_descendant_category ***************************************************************** 查询分类页链接: PHP 分类名获取分类id get_cat_ID 分类ID获取分类链接 get_category_link esc_url " title="Category Name">Category Name