Show Tags On A WordPress Theme

Since WordPress now has built-in tagging you might still need to add some code to older WordPress themes to get tags to show on your posts. Adding tags on your WordPress theme should be a pretty easy task.

There are numerous tagging plugins available that can do this for you. But if you want to control where the tags are shown on your WordPress blog then you might want to disable the plugins and edit the themes files to show the tags exactly where you want them to. The first and obvious file to add tags to is the single post template (single.php) file. The area to add the code to is typically at the end of the post (php the_content) and above and the comment section. In the example below I am showing the template tag in two different places. One is within the post meta data after the category and the other is on its own right before the comment section. The problem you might get into adding the tag code to the post meta data is if you tend to use a lot of tags it could get to be a bit long and ugly. The code added below to show tags is:
<?php the_tags(‘Tags:’, ‘, ‘, ‘<br />’); ?>.


<?php the_content(); ?>

        <p class="postmetadata">
<?php _e('Filed In&#58;'); ?> <?php the_category(', ') ?>  
<?php the_tags('Tags: ', ', ', '<br />'); ?>
</p>    
        
  
<?php the_tags('Tags: ', ', ', '<br />'); ?>
  
<div class="comments-template">

space
To find the single.php file in the WordPress dashboard go to Appearance, Editor and click single.php on the right. If you don’t have a single.php file try index.php which is usually the main blogs page but may also be used on single posts for some themes. First copy all the unedited theme code in the editor and paste it into a text file and save it for a quick backup in case you screw things up. Then find the correct location and paste in the tag code and save the file. Then check where the tags show. If you don’t like where they show keep moving the code around and remember you might need to tag the post if the tags aren’t showing!

The above sample code is by no means the way it is going to be all all themes and is only an example. Your theme might not look anything like the example above. And because of that I couldn’t cover every theme variation. And please I can’t possible look at everyone’s theme code so please take some time to experiment with your theme.

Much more about WordPress template tags can be found on the Codex.

Similar Posts:



Tags: ,

If you liked this post, feel free to leave a comment that is relevant to the post or subscribe to the feed and get future articles delivered to your feed reader.

Sorry but due to the spamming of a few all comments are moderated and will appear when approved and all drive-by comments will be deleted!

Comments

Thanks for your “Tag Custom” tips. We just try to use a different code by wp codex like this one:

<?php
the_tags(‘Tagged with: ‘,’ • ‘,”);
?>

Its work nice just like on this EDU Domain Register article’s.

Reply

Cool Gifts  Replied:

Awesome. I need to check the code on my blog to make sure I have it setup correctly. Thanks for the tutorial.

Reply

I often use WordPress, and I can say that I really like this program and so far I have it does not cause any difficulties!

Reply

why use the tags?

Reply

Jeff  Replied:

Tags are like keywords for the search engines.

Reply

Very nice – elegant and to the point. One direction I wish WP would go in is simplicity in terms of navigation links. Tags is a start at the end of the blog entry as naturally the reader who enjoyed your article may like to peruse other similar articles. It’s much better than a tag cloud (which evaporates – excuse the pun – your link equity like nothing). WP offer up way too much in terms of nav links and most WP sites have WAAAY too many links on their permanent areas of their site.

Why is this bad?

For two reasons :

1. Blindness – I’m given too much to choose from.
2. Link equity. Search engines will pass less “juice” from your home page (invariably the most valuable page on your site) to your inner pages because the power passed is diluted between many pages.

Reply

nice post dude!! I have searched about it since a few times ago.. Thanks!! :D

Reply

Great and useful tips. Actually I work on my first Wordpress theme and this might help me. Thanks

Reply

nice post, i think this is key. you need to be able to fix your own stuff, plugins are good but they are made to be portable and not for your own designs.

Reply

Code control tag, more flexible. Can be put on the template, any place where you want to!

Reply

Hi there

The theme that I am using is already showing the tags on each post, and instead of displaying the tag on the sidebar using the default plugin, i use the tag cloud plugin.

anyway, i was thinking to put all my tags (from all posts) in a specific ‘page’ instead of the sidebar. any idea how the code look like. i dont want to use the tag cloud plugin inside the page. it will look awful.

Reply

Jeff  Replied:

Not sure why you would want all tags on a single page but you could create a custom page template (Google it its out there) with the code on it. Then create a new Tags page and use that page template.

More on what to put in the template here:
http://codex.wordpress.org/Template_Tags/wp_tag_cloud

Reply

azwan  Replied:

I have my reasons :)
Thanks for the feedback. Looks like I need to make a new template from the page.php for this.

Reply

I learned something in here that you should know how to configure things Without plugins as well.

Reply

Hi thanks for sharing this, really useful! The technique might be a little more tedious than using a tagging plug-in, but if you’re after accuracy then I think it’s best to do it manually. Thanks!

Reply

Thanks a lot for your tutorial. Searched on net and couldn’t find anything that are up to my expectations. Your article helped me in the end

Reply

hi! thanks for the tutorial. this is just what i need. :-)

Reply

Unfortunately, when I tried changing the index.php, it went berzerk. The one little change caused the first post to repeat endlessly! I had to stop the browser! The “more” tag works fine, but it is just the first few words that you write. I decided to use the Post Teaser plugin, which is like the more tag…

Reply

Thanks for sharing the information. Looks as though I was clearly doing something wrong with the code on my blog.

Reply

Haha, don’t tell me, please, that’s a painful topic!
While being unexperienced, I used to put too many tags, and Google indexed my site in a terrible way because of them, so I had to delete all the tags and wait till the updating of the database.

Reply

Thanks Jeff, that is much needed. I think yahoo look more into tags, whereas google is more focus on titles when it comes to SEO?

Reply

thank you. this will be a massive bit of help

Reply

Nice post, i think this is key. you need to be able to fix your own stuff, plugins are good but they are made to be portable and not for your own designs.

Reply

I have also written almost identical blogpost. But i still find this informative.

Reply

So that’s how you add tags! Finally a simple guide on how to do so. This should definitely help with SEO.

Reply

This is a great toutorial, thank you for this great information.

Reply

It is amazing what you can do with Wordpress. I learn every day something new and this tutorial is a great help – thanks :-)

Reply

Hi Jeff, I have an old wordpres theme and it doesn’t show tags below posts.But i regularly add tags for each post.Are my tags not going to index in Google if they dont show up on the post page.Please help because i don’t want to show my tags to users but wan’t them getting indexed in google.
Thanks.My blog is http://5530xpressmusic.com/

Reply

Jeff  Replied:

I am not sure if Google uses tags anyway, tags are usually tied to social bookmarking sites that you or others would submit your posts to.

For Google I suggest using an SEO plugin like All In One SEO and place your tags into the keywords section of the post provided by the SEO plugin.

Reply

Thanks for the interesting post. Its amazing what flexibility wordpress has to make a site look whichever way you want it to. I look forward to reading more from you in the future.

Reply

Thanks for sharing this, this helped me a lot. It’s frustrating how many ElegantThemes templates don’t have a place for tags, but now I can manually add them! :-)

Reply

After reading this I have just realised why my site is not getting any hits via search engines, thank you

Reply

Looking to create a tag list that excludes tags from posts in a certain category. Never seen a way to do this. Anyone know how?
something like wp_tag_cloud(‘cat=-3′) except that doesnt work

Reply

Yeah I find often times it’s best to just dive in and change the html yourself in the header.php or page.php to really get the results you want. I use arbiteer for my templates by the way and it gets the job done quite well.

Reply

Leave a comment
Drive-By comments will be deleted! Like "Thanks for sharing", "Nice post", or any other text that doesn't contribute to the discussion. If you ask a very specific question about your particular WordPress theme, it will probably be deleted. I can fix your WordPress site but for a price. If you ask a question like "Why don't my blog work right", it will be deleted. If you ask a question about your WordPress site without a leaving a link to it, it will be deleted. The point is to ask questions and or comment on the the actual content of the post, and to please use some common sense. All comments are moderated and will appear when approved. Thank you.

(required)

(required)