wordpress中每个帖子类型的自定义标签

时间:2013-03-18 07:13:15

标签: wordpress

目前我有两种自定义帖子类型说文章#1和文章#2。我想为每个帖子类型创建自定义标签。我的意思是,如果我为文章#1创建了一个标签,它将不会在文章#2的帖子类型下显示。

请帮我怎么做

2 个答案:

答案 0 :(得分:0)

在帖子后端有标签选项你需要在那里添加标签后你必须在前端调用这些标签你可以使用这个功能

  <?php $posttags = get_the_tags();
                    if ($posttags) {
                       echo get_the_tag_list('<ul><li>','</li><li>','</li></ul>');
                    }

     ?>

答案 1 :(得分:0)

您可以做的是在$ args参数中添加名为“分类法”的附加条目&#39;在您的register_post_type中类似

$args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
                'taxonomies' => array('tag')
      );

希望这就是你要找的东西:)

相关问题