Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can I call the_tags as a list without hyperlinks?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted
<ul>
   <?php
    $tags = get_tags();

    foreach($tags as $tag) {
        echo "<li>$tag->name</li>";
   }
   ?>

</ul>
share|improve this answer
    
Thanks Ethan. Are there any other methods that will return the post tags with a separator and no links? –  Scott B Feb 9 '11 at 12:37
    
This is the only one that I know of. All other functions return tags as links. You could always write your own function. :) –  Ethan Seifert Feb 9 '11 at 17:30
add comment

It shows the tags of your post. If you use "get_tags()" you will list all tags of wordpress.

   <?php
    if (is_array(get_the_tags())) {
           $tags = get_the_tags();
           foreach($tags as $tag) {
              echo "$tag->name";
           } 
        } 
    ?>

You should check the get_the_tags() if "is_array()" or you'll get error case the_post() doesn't have a tag .

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.