wordpress之wp_list_categories函数

该函数用来输出一个某个分类法下的分类列表,输出的是html格式,默认是 <li>…</li>

$term = get_term_by('slug', 'software', 'product_category');
wp_list_categories([
    'taxonomy' => 'product_category', // 分类法
    'child_of' => $term->term_id, // 哪个分类的子分类
    'depth' => 0, 
    'hide_empty'=>false, // 如果该分类下没有文章,是否隐藏
    'title_li' => ''
] );

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注