Simple question: <?php the_tags(); ?> How can I limit it to display only 3 tags or the first three tags. I've tried some other code from Wordpress doc..but couldn't get it work!
Could you possibly explain a little further in detail so I can attempt to help you out? From what I've read, you can create separate "post_tags();" and list them (each of them including one tag, or an array for wordpress).
That function is only good for changing the separators between the tags. To limit the number of tags, you need to use get_the_tags() and a loop counter. The code you want has already been posted on the Wordpress forums. http://wordpress.org/support/topic/show-only-the-first-three-tags <?php $count = 0; $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $count++; if ($count <= 3 ) { echo '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a> '; } } } ?> Code (markup):