+321 123 4567
info@test.com
  • Home
  • My Services
    • Web Design
    • Web Development
    • Technical Writing
  • Portfolio
  • My Thoughts
  • Free Tools
    • Photo Editor
    • Avatar Generator
    • Email Migration Tool
    • QR Code Generator
    • RSS to HTML Converter
    • IP Address Geolocation
    • Base64 Image Encoder
    • NATO Translator
    • All Tools
  • Contact
Home
Wordpress
How to Make WordPress Tags Link to Search Page

How to Make WordPress Tags Link to Search Page

Wale Adekile
November 1, 2016

To be honest, I’ve always felt as if WordPress tags are useless. Even though I use them, I’ve never really liked it. The problem is that I’m never consistent with the way I use them. For instance, you might use a tag just once and never use it again despite having topics that could use it. I was thinking of a way to make these tags more functional and thought linking them to the search page (to actually search your site for that particular query) was a good idea.


After going back and forth, I came up with this piece of code:

[php]<span class="entry-tags"> Hashtags: <?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo ‘<a href="https://www.doncaprio.com/?s=’. $tag->name . ‘"
>#’ . $tag->name . ‘</a> ‘;
}
}
?></span>[/php]

You can see it in action by checking the “hashtags” below this post. Obviously, you need to change www.doncaprio.com in the code to your own domain name.

To implement this, you need to edit your theme file and replace the default code displaying tags with this. If you’re using Genesis, simply do this through Genesis Simple Hooks (genesis_entry_footer). But you may need to delete the shortcode displaying tags using Genesis Simple Edits to avoid repetition.


Previous Post
Seriously, Jailbreaking Your iPhone Won’t Kill It
Next Post
Your Ultimate iPad Buying Guide for 2016/2017
Wale Adekile
Husband to the world's most beautiful woman and father to two awesome kids. A nerd, obviously; also, a technical business analyst, a web designer who preaches the gospel of WordPress, and a writer. You can check out my published books on Amazon.
facebook comment box for genesis
Wordpress

Adding Facebook Comment to Genesis Without a Plugin

12 years ago
publish .doc or .docx document to wordpress
Wordpress

How to Publish Word Document with Images Directly to WordPress / Blogger

13 years ago

Recent Articles

wahl rapic clip hair clipper
Wahl Rapid Clip Hair Clipper Review: DIY Made Easy
BenQ LaptopBar Review: Luxury or Necessity?
yunmai easepro unboxed
Yunmai EasePro Massage Gun Review
g20
Teendow G20 Robot Vacuum and Mop Review
bathroom
Dear Men, Spraying All Over the Toilet Seat is Disgusting and Irresponsible
winx mediatrans
How to Transfer Photos from iPhone to Computer Without iTunes
google workspace
How to Migrate Emails From Google Workspace/G Suite to cPanel
synology diskstation ds920+
Synology DiskStation DS920+ Review
playstation 4
Why I haven’t Upgraded to the PlayStation 5 Yet
pain
Started Watching Anime as an Adult? You’re Not Alone

All contents on this blog are copyright protected and cannot be reproduced on other websites without permission.

Copyright © 2022 – NerdieDad | Home | Contact | About | Privacy Policy