我有一个网站,其中列出了侧导航的子类别列表。我需要将这些子类别划分为更具体的层次结构。它当前正在从父类别输出一个列表,但不显示超出该类别的层次结构。我有点被困在下一步了。
这就是我现在所拥有的:
foreach($subcategory as $key => $val) {
$args = array(
\'posts_per_page\' => -1,
\'post_type\' => \'storefront\',
\'hierarchical\' => true,
\'child_of\' => $parent->term_id,
\'post_status\' => array(\'publish\', \'private\'),
\'taxonomy\' => \'sfcategory\',
\'tax_query\' => array(
array(
\'taxonomy\' => \'sfcategory\',
\'field\' => \'id\',
\'terms\' => $val,
\'child_of\' => $parent->term_id
)
)
);
$countStorefront = get_posts($args);
$count = count($countStorefront);
if($count) {
$html .= "<li><a href=\'".site_url(\'community?subcat=\').$val."\'>".$key."</a></li>";
} else {
$html .= "<li>".$key."</li>";
}
}
$html .= "</div>";