2012-10-31 3 views
2

나는 필터가있는 제품 페이지가 있습니다. 범주가 없으면 '범주 없음'텍스트를 숨기려고합니다.WordPress에서 '카테고리 없음'숨기기

<?php wp_list_categories(array('taxonomy' => 'products', 'orderby' => 'order', 'title_li' => '', 'child_of' => ($term->parent==0) ? $term->term_id : $term->parent)); ?> 

어떻게 구현할 수 있습니까?

답변

1

빈 문자열로 인수 배열에 show_option_none를 추가하고 설정 :

<?php wp_list_categories(array('show_option_none' => '', 'taxonomy' => 'products', 'orderby' => 'order', 'title_li' => '', 'child_of' => ($term->parent==0) ? $term->term_id : $term->parent)); ?> 


을 당신은 또한, 예를 들어 쉽게 디버그가 아닌 하나의 긴 라인 그래서 조금 코드를 재 작성 할 수 있습니다 :

<?php 

$args = array(
    'taxonomy' => 'products', 
    'orderby' => 'order', 
    'title_li' => '', 
    'child_of' => ($term->parent == 0) ? $term->term_id : $term->parent 
    'show_option_none' => '', 
); 

wp_list_categories($args); 

?> 
관련 문제