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.

As the title states all I'm trying to do is get the descriptions for all tags inside the loop on my INDEX.php page to show up.

I know you can use code to call specific tag descriptions but I want to avoid that if possible since I'll have hundreds of tags all of which I want to show descriptions for.

Is there a way to modify the get_tags tag in the loop to display descriptions following each tag?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Modified from the get_tags() Codex Example

$tags = get_the_tags(); // for the specific post
// $tags = get_tags(); // all tags
$html = '<div class="post_tags">';
foreach ( $tags as $tag )
{
    $tag_link = get_tag_link( $tag->term_id );

    $html .= "Describtion for ".ucfirst( strtolower( $tag->name ) ).": $tag->description";
    $html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>{$tag->name}</a>";
    }

$html .= '</div>';
echo $html;
share|improve this answer
    
This is great man. I appreciate that you took the time to write this, thank you. I should of been a bit more specific and will be in the future. Is there a way to limit the tags to only the ones associated with each post? (Rather than displaying all of them in the database.) –  Kapitol Jun 28 '11 at 1:01
    
See updated A and save the link to the Function Reference. –  kaiser Jun 28 '11 at 1:51
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.