1 回答
TA贡献1883条经验 获得超3个赞
请记住将 woocommerce/template/loop/loop-start.php 和 loop-end.php 复制到你的 theme/woocommerce/loop/loop-start.php 和 loop-end.php
循环/loop-start.php
/*This is the main cat on homepage or shop page*/
if (is_shop()|| is_front_page()) {
/*this can be any thing you want it to be <ul><div>*/
echo '<div class="yourclass">';
}
/*this should be your sub categories 1 level down*/
else if ( is_product_category(array('cat1', 'cat2','cat3', 'cat4', 'cat5'))){
/*this can be any thing you want it to be <ul><div>*/
echo '<div class="yourclass">';
}
/*this should be your sub categories 2 level down*/
else if ( is_product_category(array('subcat1','subcat2'))){
echo '<ul class="products" id="NORMAL">';
}
然后在loop-end.php
/*This is the main cat on homepage or shop page*/
if (is_shop()|| is_front_page()) {
/*this can be any thing you want it to be <ul><div>*/
echo '</div>';
}
/*this should be your sub categories 1 level down*/
else if ( is_product_category(array('cat1', 'cat2','cat3', 'cat4', 'cat5'))){
/*this can be any thing you want it to be <ul><div>*/
echo '</div>';
}
/*this should be your sub categories 2 level down*/
else if ( is_product_category(array('subcat1','subcat2'))){
echo '</ul>';
}
应该有更好的方法来做到这一点,但对我来说,这是我所能做的。
- 1 回答
- 0 关注
- 129 浏览
添加回答
举报