我使用以下代码显示子类别列表:
<?php
if (is_category()) {
$this_category = get_category($cat);
}
if($this_category->category_parent)
$this_category = wp_list_categories('orderby=id&title_li=&child_of='.$this_category->category_parent."&echo=0"); else
$this_category = wp_list_categories('orderby=id&title_li=&child_of='.$this_category->cat_ID."&echo=0");
if ($this_category) { ?>
<?php echo $this_category; ?>
<?php } ?>
如何在2列中显示子类别?
答案 0 :(得分:0)
Wordpress通过这些功能为您提供了大量内容。它们为您提供了许多使用此内容的功能,但如果您遇到困难并且没有任何功能符合您的需求,请随时创建自己的功能。
在这里,尝试对象$ this_category的var_dump(),然后查看结果。
然后,您应该能够使用此内容以您希望的方式显示您的类别。