1 回答

TA貢獻(xiàn)1883條經(jīng)驗(yàn) 獲得超3個(gè)贊
請(qǐng)記住將 woocommerce/template/loop/loop-start.php 和 loop-end.php 復(fù)制到你的 theme/woocommerce/loop/loop-start.php 和 loop-end.php
循環(huán)/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>';
? ? }
應(yīng)該有更好的方法來(lái)做到這一點(diǎn),但對(duì)我來(lái)說(shuō),這是我所能做的。
- 1 回答
- 0 關(guān)注
- 154 瀏覽
添加回答
舉報(bào)