开发者

How to get the tag without a href link

in wordrpess i am using wp_list_tag to generate the tags but i need the tags without the link can any one help me to get the tag without the a href link

t开发者_C百科hanks, Ram


Why not use the get_terms() method to get an array and generate your HTML?

http://codex.wordpress.org/Function_Reference/get_terms (look at the examples section)

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

     }
     echo "</ul>";
}


you can use this :

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

the result is an array of names ;)

good luck


Can you please add below code:

<?php
    $tags = get_tags();
    $html = '<div class="post_tags">';
    foreach ( $tags as $tag ) {
        $html .= "{$tag->name}";
    }
    $html .= '</div>';
    echo $html;
?>


You could use jQuery to remove it, I'm sure there are other alternative's but if you're looking for an easy way out, try this:

$(function() {
    $('.foo').removeAttr('href');
});

example: http://jsfiddle.net/ExxRX/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜