我使用的是需要在不同类别页面上显示特定内容的代码.
我的分类有以下 struct :
男人
- 布料
-
- 短裤
-
-
- 短裤 with pockets
-
But the code below, displays content only on the parent category (男人), and the 1st level subcategory (布料):
add_action( 'woocommerce_archive_description', 'add_slide_text',1 );
function add_slide_text() {
$cat = get_queried_object();
if ( is_product_category() ) {
if ( is_product_category( 'man' ) || $cat->parent === 233 ) {
echo 'Hello man';
} elseif ( is_product_category( 'woman' ) || $cat->parent === 232 ) {
echo 'Hello woman';
} else {
echo '';
}
}
}
我如何才能强制它显示更低级别的子类别上的内容?例如,在"短裤"和"带口袋的短裤"中有(and possibly lower)个?
如有任何帮助,我们不胜感激.