2014-10-31 3 views
1

나는 다음과 같은 목록에 표시되지 카테고리를 제외하기 위해 노력하고있어 : 목록에서 범주를 제외 - 워드 프레스

<?php 
    $categories = get_categories('orderby=id&exclude=1,'. getOption('promo-categorie', false)); 
    foreach($categories as $category) : 
     $active = (!is_home() && get_query_var('cat') == $category->term_id)? ' style="color: ' . getOption($category->category_nicename . '-color', false) . '"' : ''; 
     $catLink = (get_query_var('cat') == $category->term_id) ? get_bloginfo('wpurl') : get_category_link($category->term_id); 
?> 
    <a class="nav-links" href="<?php echo (get_query_var('sort') == 'list')? add_query_arg(array('sort' => 'list'), $catLink) : $catLink ?>" <?php echo $active; ?>><?php echo $category->name; ?></a> 
<?php 
    endforeach; 
?> 

내가 PHP와 총 newb 해요,하지만 내가 말할 수있는 "프로모션 - categorie에서 "는 제외되었습니다. 또한 다른 카테고리를 제외하고 싶습니다.

도움을 주시면 감사하겠습니다.

답변

3

당신은 그것을했다

$args = array( 
    'hide_empty'    => 1,  
    'exclude'     =>array(1,2,3) // desire id 
); 

$categories = get_categories($args); 
+0

같은 매개 변수를 제외 여러 ID를 전달할 수 array.You의 ID를 제외 할 수 있습니다. 협조 해 주셔서 감사합니다. – kesernio