How To Add/Activate Tags In WordPress Themes And Posts

By | August 17, 2013

A few days ago I wrote about how I’m starting a new experiment with my website where I’m gonna test and see just how much of an effect do WordPress tags have on search engine optimization. I’m not gonna be talking about that now, but I am gonna talk about something that I discovered when trying to activate tags on my website, and that something is that my theme does not support tags. Here’s a short tutorial on how to add tags to WordPress, more precisely WordPress themes.

wordpress add tags activate themes how added tags

The very short snippet of code that needs to be added to your WordPress theme, in order for tags to show up can be seen on the image above. Here it is in text form so that you can simply copy/paste it into the website that you’re working on.

<?php the_tags(); ?>

Now there are some other arguments that you can add alongside this small snippet of code in order to fine tune how the tags are gonna be showed but if you’re only interested in showing tags somewhere on your WordPress powered site and nothing else fancy, then the only thing that you need to do is add this snippet of code inside a theme file, theme file that your website is using. This can be done by open opening up theme editor (Appearance >> Editor) from inside the WordPress dashboard.

wordpress add tags activate themes how added tags working

Where exactly will you be adding this code snippet is entirely up to you. If you scroll down to the very end of this post you will see that I like to have my tags showed after the visitor finishes reading the post, meaning at the end of the post. If you can’t be bothered to scroll, you can see example tags on the image above.

Since I’m adding tags to the post page, I need to open up single.php inside the WordPress theme editor and there somewhere at the bottom simply add the code snippet that I’ve given a few lines back. If you want to add tags to the top of the post, you’re more than welcome to do that. Try to add tags to post pages only, because I’m not sure that they would be useful anywhere else. That’s it, adding tags is not overly complicated, but still confusing to some. Here’s a link to the full WordPress documentation on the tag function that we just showed you here.

WordPress Tag Function Explained

Pocket

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.