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.

So I had to fiddle allot with tag cloud to display it correctly. My script limits display to 5, and since I don't display all tags, I'd like wp to output list in descending order based on popularity. So if tag has most posts it will be displayed first, and so on... Is this possible? I have a hunch I've to modify get_the_tags(), but not sure how as of now... any help appreciated! :)

                        <?php

                    rewind_posts();
                    while (have_posts()) : the_post();

                    $posttags = get_the_tags();
                    $counttag=0;
                    if ($posttags) {
                        foreach($posttags as $tag) {
                            $counttag++;
                            echo '<li><a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a></li> ';
                            if( $counttag >5 ) break;
                        }
                    }

                    endwhile;

                    ?>
share|improve this question
    
nobody? really? –  Sandro Dzneladze Sep 23 '11 at 14:48
    
WordPress has function wp_tag_could() maybe you should try output tag cloud with it –  Mamaduka Sep 24 '11 at 13:50
    
wp_tag_could() I cannot make it target particular post. it rather outputs all /most popular tags from the whole blog. I want post specific tags to be displayed. –  Sandro Dzneladze Sep 26 '11 at 14:11

1 Answer 1

up vote 0 down vote accepted

This is a little bit more complicated than I thought.

But I did find this link Which should help you on your path. Minus the custom post types, the code should be what you are looking for.

share|improve this answer

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.