2017-11-20 3 views
0

ポストにタグを追加するサポートを追加するにはどうすればよいですか?私はすべてを試しましたが、ポストタグオプションは表示されず/表示されません。カスタムメニューのワードプレスダッシュボードにポストタグを追加する

enter image description here

register_post_type('articles', 
    array(
     'labels' => array(
      'name' => __('Articles'), 
      'singular_name' => __('Articles') 
     ), 
     'supports' => array('title', 'editor', 'thumbnail', 'comments', 'revisions', 'excerpt','page-attributes','post-formats','custom-field'), 
     'public' => true, 
     'has_archive' => true, 
     'rewrite' => array('slug' => 'articles'), 
    ) 
); 

答えて

1

、カスタムタグオプションでカスタムポストタイプを取得することができます。

それはあなた

のために動作します

//* Create Custom Post Type 
 
add_action('init', 'add_custom_post_type'); 
 
function add_custom_post_type() { 
 

 
\t register_post_type('members', 
 
\t \t array(
 
\t \t \t 'labels' => array(
 
\t \t \t \t 'name'   => __('Members', 'wpsites'), 
 
\t \t \t \t 'singular_name' => __('Member', 'wpsites'), 
 
\t \t \t), 
 
\t \t \t 'has_archive' => true, 
 
\t \t \t 'hierarchical' => true, 
 
         'menu_icon' => 'dashicons-admin-users', 
 
\t \t \t 'public'  => true, 
 
\t \t \t 'rewrite'  => array('slug' => 'members', 'with_front' => false), 
 
\t \t \t 'supports'  => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'page-attributes'), 
 
\t \t \t 'taxonomies' => array('member-type'), 
 
         'menu_position' => 2, 
 

 
\t \t)); 
 

 
} 
 

 
add_action('init', 'create_custom_tag'); 
 

 
function create_custom_tag() { 
 
\t register_taxonomy(
 
\t \t 'tag', 
 
\t \t 'members', 
 
\t \t array(
 
\t \t \t 'label' => __('Tag'), 
 
\t \t \t 'rewrite' => array('slug' => 'tag'), 
 
\t \t \t 'hierarchical' => true, 
 
\t \t) 
 
\t); 
 
}

、このコードを試してみてください

0

あなたはレジスタ機能にpost_tag分類を追加する必要があります。このコードで

register_post_type('articles', 
    array(
     'labels' => array(
      'name' => __('Articles'), 
      'singular_name' => __('Articles') 
     ), 
     'supports' => array('title', 'editor', 'thumbnail', 'comments', 'revisions', 'excerpt','page-attributes','post-formats','custom-field'), 
     'taxonomies'=>array('post_tag'), 
     'public' => true, 
     'has_archive' => true, 
     'rewrite' => array('slug' => 'articles'), 
    ) 
); 
関連する問題