2014-04-15 4 views
0

뉴스 게시 유형으로 미리보기, 태그 및 ... 범주WP - 사용자 정의 게시 유형의 범주

단일 사용자 정의 게시 페이지에 표시 범주 목록에 문제가 있습니다. The_category(); 내 맞춤 게시물 유형이 아닌 기본 게시물 유형의 카테고리 목록을 표시합니다.

functions.php

// Register new custom post category - blog 

function blog_post_type() { 
    $labels = array(
     'name'    => _x('Blog', 'post type general name'), 
     'singular_name'  => _x('Blog', 'post type singular name'), 
     'add_new'   => _x('Dodaj', 'post'), 
     'add_new_item'  => __('Dodaj Post'), 
     'edit_item'   => __('Edytuj Post'), 
     'new_item'   => __('Nowy Post'), 
     'all_items'   => __('Wszystkie Posty'), 
     'view_item'   => __('View Post'), 
     'search_items'  => __('Szuakj postu'), 
     'not_found'   => __('Nie znaleziono'), 
     'not_found_in_trash' => __('Nie znaleziono w koszu'), 
     'parent_item_colon' => '', 
     'menu_name'   => 'Blog' 
    ); 
    $args = array(
     'labels'  => $labels, 
     'description' => 'Wpisy na blogu', 
     'public'  => true, 
     'menu_position' => 5, 
     'supports'  => array('title', 'editor', 'thumbnail', 'excerpt', 'comments'), 
     'has_archive' => true, 
     'hierarchical' => true, 
     'taxonomies' => array('post_tag', 'category'), 
    ); 
    register_post_type('blog', $args);  
} 
add_action('init', 'blog_post_type'); 

function blog_taxonomies() { 
    $labels = array(
     'name'    => _x('Kategorie', 'taxonomy general name'), 
     'singular_name'  => _x('Kategoria', 'taxonomy singular name'), 
     'search_items'  => __('Szukaj Kategorii'), 
     'all_items'   => __('Wszystkie Kategorie'), 
     'parent_item'  => __('Nadrzędna Kategoria'), 
     'parent_item_colon' => __('Nadrzędna Kategoria:'), 
     'edit_item'   => __('Edytuj Kategorię'), 
     'update_item'  => __('Zaktualizuj Kategorię'), 
     'add_new_item'  => __('Dodaj Nową Kategorię'), 
     'new_item_name'  => __('Nowa Kategoria'), 
     'menu_name'   => __('Kategorie'), 
    ); 
    $args = array(
     'labels' => $labels, 
     'public' => true, 
     'hierarchical' => true, 
     'taxonomies' => array('category'), 
    ); 
    register_taxonomy('blog_category', 'blog', $args); 
} 
add_action('init', 'blog_taxonomies', 0); 

내 사용자 정의 포스트 형 루프 :

$args = array(
       'post_type' => 'Blog', 
       'cat' => $catID, 
       'author' => $authorID 
      ); 

      $temp = $wp_query; 
      $wp_query= null; 
      $wp_query = new WP_Query($args); 

if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); 

CONTENT with the_category(); 

endwhile; 

else: 

endif; 

어떤 아이디어?

감사합니다. 당신이 당신의 포스트 유형을 등록 할 때

Silon

답변

0

, 당신은 카테고리 post_tagcategory에 등록하고 있습니다.

function blog_post_type() { 
    // some labels 
    $args = array(
     // more args 
     'taxonomies' => array('post_tag', 'category'), 
    ); 
    register_post_type('blog', $args);  
} 

그러나 나중에, 당신은라는 분류를 등록 blog_category (, 당신은 내부의 잘못된 인수 (분류 체계)를 사용하고 그 위에 register_taxonomy

function blog_taxonomies() { 
    //some labels 
    $args = array(
     // more args 
     'taxonomies' => array('category'), 
    ); 
    register_taxonomy('blog_category', 'blog', $args); 
} 

의 첫 번째 매개 변수를 참조 전화 번호 : register_taxonomy 전화 번호 : Codex documentation

게시물 유형에 따라 카테고리 분류가 제대로 작동하지 않는 이유는 무엇입니까?

관련 문제