如何在前端显示分类链接?

时间:2018-07-16 10:01:04

标签: wordpress

我在管理员后端注意到了这种分类法,并希望将针对每个帖子检查的所有内容显示在前端:

    register_taxonomy(
        "package-category", array("package"), array(
            "hierarchical" => true,
            "label" => "Package Categories", 
            "singular_label" => "Package Categories", 
            "rewrite" => true));
    register_taxonomy_for_object_type('package-category', 'package');

我如何在single.php上显示它?

我尝试过:

                    $package-category = get_the_term_list( $post->ID, 'package_category', '', ', ' , '' );
                if(!empty($package_category)){
                    echo '<div class="package-info"><i class="icon-tag"></i>';
                    echo '<span class="head">Categories </span>';
                    echo $package_category;
                    echo '</div>';
                }       

但是它显示了诸如/ package-category / page1之类的奇怪链接,而不仅仅是/ page1

0 个答案:

没有答案