WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone have any idea on how i can limit the number of tags shown in a post and if there is more it's a drop down menu.

Here's an example of what i mean.

enter image description here

Se where it sats "More On" those are the tags, I want to be able to show only 3 tags and then after that a drop down menu for the rest of the tags.

Is this possible, If so how can I do this. Only Tags Attached To The Post

share|improve this question

This can be a start...

$tags = wp_get_post_tags($post_id);
$html = '<div class="post_tags">';
foreach ( $tags as $tag ) {
    $tag_link = get_tag_link( $tag->term_id );  
            $html .= '<ul class="post_tags_menu">';
        $html .= "<li><a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
        $html .= "{$tag->name}</a><li>";
        $html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
        $html .= "{$tag->name}</a>";
    $html .= "</ul>";
$html .= '</div>';
echo $html;

How to get post tags http://codex.wordpress.org/Function_Reference/wp_get_post_tags

share|improve this answer
Only Tags Attached to the post not all tags – Mihad Aiko Feb 25 '13 at 7:47
@MihadAiko have edited my answer, please look.. – Rajeev Vyas Feb 25 '13 at 7:53
I don't even know where to begin with that :( @Rajeev – Mihad Aiko Feb 25 '13 at 8:00
Does Anyone else have an answer – Mihad Aiko Feb 25 '13 at 18:48

Your Answer


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.