2016-06-30 2 views
0

이 샘플과 같은 카테고리에 대한 사용자 정의 게시 유형을 어떻게 만들 수 있습니까? 입력 상자에 텍스트를 입력하고 카테고리 이름으로 가져옵니다.카테고리에 대한 사용자 정의 게시 유형 생성

public function panotour_register_post_type(){ 
    register_post_type(self::$custom_post_type,array(
      'taxonomies' => array('category'), 
      'name'   => 'CategoryName', 
      'hierarchical' => true, 
      'query_var' => true 
     ) 
    ); 
} 
+0

하셨습니까 ** 사용자 정의 포스트 유형에 사용자 정의 분류를 변환 **, 사용자 정의 포스트 유형을 작성하고 분류 체계를 사용하여 범주에 해당 게시물의 유형을 추가? – purvik7373

답변

0

function create_post_type() { 
    $args = array(
     'label'    => __('cpost', 'twentythirteen'), 
     'description'   => __('Custom Post Type', 'twentythirteen'), 
     'supports'   => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields',), 
     'hierarchical'  => false, 
     'public'    => true, 
     'show_ui'    => true, 
     'show_in_menu'  => true, 
     'show_in_nav_menus' => true, 
     'show_in_admin_bar' => true, 
     'menu_position'  => 5, 
     'can_export'   => true, 
     'has_archive'   => true, 
     'exclude_from_search' => false, 
     'publicly_queryable' => true, 
     'capability_type'  => 'page', 
     'taxonomies'   => array('category_name'), 
    ); 

    // Registering Custom Post Type 
    register_post_type('cpost', $args); 

} 

add_action('init', 'create_post_type', 0); 
+0

대단히 감사합니다. PHP 사용자는 훌륭하고 완벽하지만 원하는 것은 범주 이름으로 넣을 이름 일뿐입니다. 예를 들어 학교, 아파트, 쇼핑몰을 입력하면 게시물의 카테고리가됩니다. 가능한가요? – wptour

관련 문제