2016-08-15 3 views
0

WordPress에서 내 테마에 대한 분류로 사용자 정의 게시물을 만들려고합니다. 사용자 정의 게시물은 제대로 작동하지만 내 분류는 관리자 워드 프레스 패널에 표시되지 않습니다. 내 맞춤 게시물 유형에 대한 WordPress 분류 체계가 작동하지 않습니다.

나는

library.inc.php라는 이름의 다른 페이지에서 코드의이 부분을 작성하고 난 문제가 정확히 어디 있는지 찾을 수 없습니다

function.php

에 포함되어 있습니까?

여기 내 코드

function p2p2_register_book(){ 
    $labels = array(
     'name'    => _x('کتابخانه', 'books'), 
     'singular_name'  => _x('کتاب', 'book'), 
     'add_new'   => _x('افزودن کتاب', ''), 
     'add_new_item'  => __('افزودن کتاب جدید'), 
     'edit_item'   => __('ویرایش کتاب'), 
     'new_item'   => __('کتاب جدید'), 
     'all_items'   => __('همه کتاب ها'), 
     'view_item'   => 'View Book', 
     'search_items'  => __('جست و جو کتاب'), 
     'not_found'   => _('کتاب یافت نشد'), 
     'not_found_in_trash' => __('کتاب در زباله دان یافت نشد'), 
     'parent_item_colon' => '', 
     'menu_name'   => 'کتابخانه' 
    ); 
    $args=array(
      'labels'    => $labels, 
      'public'    => true, 
      'publicly_queryable' => true, 
      'show_ui'   => true, 
      'show_in_menu'  => true, 
      'query_var'   => true, 
      'menu_position'  => 2, 
      'rewrite'   => array('slug' => 'book'), 
      'capability_type' => 'page', 
      'has_archive'  => true, 
      'hierarchical'  => false, 
      'menu_position'  => null, 
      'supports'   => array('title', 'editor', 'thumbnail', 'comments' ,'custom-fields'), 
      // 'taxonomies' => array('Books_category','post_tag'), 

     ); 
    register_post_type('Book',$args); 

} 

    add_action('init', 'p2p2_register_book'); 

이며, 여기에 사용자 등록이의 definetly 작동 분류가하는 코드 다음

  function wp_library_post_taxonomy() { 
      register_taxonomy(
       'Books_category', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces). 
       'Book',     //post type name 
      array(
      'hierarchical'   => true, 
      'label'       => 'دسته بندی کتاب', //Display name 
      'query_var'    => true, 
      'show_admin_column'    => true, 
      'rewrite'      => array(
       'slug'     => 'Books-category', // This controls the base slug that will display before each term 
       'with_front' => true // Don't display the category base before 
       ) 
      ) 
    ); 
} 
     add_action('init', 'wp_library_post_taxonomy'); 

     include_once('mixitup-plug.php'); 
     add_theme_support('post_thumbnails'); 
     add_image_size('Books_small_image',150,200,true); 

답변

0

사용 분류 부분을이다. :)

//hook into the init action and call create_book_taxonomies when it fires 
    add_action('init', 'wp_library_post_taxonomy', 0); 

//create a custom taxonomy name it topics for your posts 

function wp_library_post_taxonomy() { 

// Add new taxonomy, make it hierarchical like categories 
//first do the translations part for GUI 

    $labels = array(
     'name' => _x('Taxonomy Names', 'taxonomy general name'), 
     'singular_name' => _x('Taxonomy Name', 'taxonomy singular name'), 
     'search_items' => __('Search Taxonomy Names'), 
     'all_items' => __('All Taxonomy Names'), 
     'parent_item' => __('Parent Taxonomy Names'), 
     'parent_item_colon' => __('Parent Taxonomy Name:'), 
     'edit_item' => __('Edit Taxonomy Name'), 
     'update_item' => __('Update Taxonomy Name'), 
     'add_new_item' => __('Add New Taxonomy Name'), 
     'new_item_name' => __('New Granite Taxonomy Name'), 
     'menu_name' => __('Taxonomy Name'), 
    ); 

// Now register the taxonomy 

    register_taxonomy('Taxonomy Name',array('custom_post_type name'), array(
     'hierarchical' => true, 
     'labels' => $labels, 
     'show_ui' => true, 
     'show_admin_column' => true, 
     'query_var' => true, 
     'rewrite' => array('slug' => 'Taxonomy Name'), 
    )); 

} 
0

여기 내가이 분류의 정확한 이름을 가진 부분 ..... 해결 문제를 다시 쓸 수 있도록 문제가 있지만 결과를 찾아 6 시간 가까이 지출 대답 입니다. WordPress의 문제점을 정확히 알지 못합니다. 정말로 6 시간 동안 아무것도?

관련 문제