我有一个由另一个人制作的自定义php菜单,它基本上将这些类别显示为菜单。但是,我们还需要它来显示子类别。我尝试添加分层参数但它不起作用。希望得到一些帮助!
以下是代码:
<ul>
<?php
/* Get all the categories for wp e-commerce products */
$wpec_product_categories = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=0&exclude=298');
$myarray = array();
foreach($wpec_product_categories as $wpec_categories){
$myarray[$wpec_categories->term_id]['name'] = $wpec_categories->name;
$myarray[$wpec_categories->term_id]['slug'] = $wpec_categories->slug;
$myarray[$wpec_categories->term_id]['term_id'] = $wpec_categories->term_id;
}
foreach($myarray as $wpec_categories1){
$wpec_term_name = $wpec_categories1['name'];
$wpec_term_slug = $wpec_categories1['slug'];
$wpec_term_id = $wpec_categories1['term_id'];
echo '<li> <a href="'.get_page_link(19).''.$wpec_term_slug.'" >'. $wpec_term_name.'</a></li>';
}
?></ul>