1
此代碼提取了一個類別列表,但我只需要顯示正在查看的當前類別的子類別。有任何想法嗎?WordPress的:吐出兒童類別列表?
<ul class="categoryNav">
<?php
$args = array(
'show_option_all' => '',
'orderby' => 'name',
'order' => 'ASC',
'style' => 'list',
'show_count' => 0,
'hide_empty' => 1,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 1,
'title_li' => __(''),
'show_option_none' => __(''),
'number' => null,
'echo' => 1,
'depth' => 1,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'product_cat',
'walker' => null
);
wp_list_categories($args);
?>
</ul>
我試過了,我創建的所有類別似乎都在子類別 –
上顯示,看起來$ cat_id仍然是0.嘗試將它手動設置爲所需的ID,然後編寫一個函數來設置它動態地取決於你在哪裏 – niklas