开发者

Wordpress - Display Taxonomy Terms without Links - (get_terms, the_terms, wp_tag_cloud)

Is there a way to display Taxonomy Terms without them being a link?

I basically want to display all the terms underneath my Taxonom开发者_StackOverflow社区y of "Headings," but without them being links.

I've tried multiple solutions such as get_terms, get_the_terms, the_terms, wp_tag_cloud but I was unable to find a solution.

Thanks.


The solution of bizarre returned all terms, if you need to display only the terms per post item you can use this:

$terms = wp_get_post_terms( $post->ID, 'taxonomy-term', array("fields" => "names") );
echo implode(', ',$terms);

Make sure to get the right "taxonomy-term" correct!


below code retrieve all terms name of a taxonomy :

    $terms = get_terms( 'cars', array('fields'    => 'names')); 


$terms = get_terms("taxonomy");
                 $count = count($terms);
                 if($count > 0)
                     {
                         echo '<ul>';
                         foreach ($terms as $term) 
                             {
                                 echo '<li>'.$term->name.'</li>';
                             }
                         echo '</ul>';
                     }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜