donglipi4495 2010-10-28 18:44
浏览 10

从WordPress功能中剥离标签

Trying to print my custom post type's taxonomy but without the link. Tried this, but doesn't seem to work, any suggestions?

$text = the_terms($post->ID,'type','','',''); 
echo strip_tags($text);

Any help would be greatly appreciated... I'm about to start punching babies.

  • 写回答

2条回答 默认 最新

  • dongque1646 2010-10-28 20:14
    关注

    the_terms() display the terms, but you cant store them into a variable because they are echoed. You should try get_terms() instead.

    $myterms = get_terms('category', 'orderby=count&hide_empty=0');
    

    For future use, the the_something() methods print the specific content ito the template and the get_something() methods return the content so you can store it into a variable.

    评论

报告相同问题?