HOWTO: Display tags with tag count on a post
Hey all,
For a while I've been wanting to display the tags on a post only if there are more than 1 posts with that tag, and showing the total number of posts with that tag. The idea is to encourage site navigation by linking similar posts with tags, and not making people click on a tag only to find no other posts. So the result would look like this: View more posts tagged with: Elephants (3), Rabbits (1) I have thrashed out the following code, which works. It is quite possibly not the most elegant solution so if you can improve it feel free ;) I'm still using 3.5.1 so I just include this in Style & Edit Center Column > The Loop, underneath the post byline. Code:
<?php |
All times are GMT -6. The time now is 02:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.