+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.
Wordpress

How to Add Google Adsense / HTML Codes to Genesis Without A Plugin

13 years ago
Wordpress

How To Transfer WordPress From WampServer To cPanel

10 years ago

Recent Articles

yunmai massage gun mini 2.
Yunmai Massage Gun Mini 2 Review
BenQ LaptopBar Review: The Accessory I didn’t Know I Needed
teendow g20
Teendow Robot Vacuum G20 Review
Yunmai EasePro Massage Gun 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
How to Use WhatsApp on an iPad
Things to Consider When Buying a MacBook
programmer
Learning to Code: A Comprehensive Guide for Beginners
identity thief
How to Efficiently Prevent Identity Theft

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