Tags to search

Posted in: Newspaper
Post count: 4

Hi,

Great theme, loving it!

I would like to change the default functionality of tags in the theme.

When you click on a tag, instead of navigating to the tag page, you should be taken to the the search page with the tag as a search string.

Post count: 9544

Hi,
that isn’t a normal function of tags in WordPress, since the tags by default go to the actual tag. Likely you would need to create some custom code, with help of a developer, or perhaps create custom function to redirect tags from the tag page to a search page. Not sure that’s good for SEO, and perhaps not good for “too many queries” to the dbase if you use a lot of tags.

Not something included with theme, and not part of the theme in any way. So, probably you would need to hire a developer to change a core function of WordPress to do that.

Since the tags which appear on the post pages are from an array, pulled from the post meta data, you’d have to either hack the WP core to redirect such links on the post page, or likely easier create custom fields for your new “s-tags” which have a URL associated with the tag, which leads to the search; then “print” your custom fields at bottom of posts, and turn off the theme function to pull the normal tags array.

Perhaps that might help point you in right direction. 🙂

Post count: 4

Hi Christopher,

Thank you for your reply.

Ive looked through the theme, and i cannot find the function / place where the tags are fetched in the page.

I’d simply just like to modify the function slightly from

website.com/tag/nameoftag
to
website.com/?s=nameoftag

Post count: 9544

Right. it’s not that simple. Perhaps Lucian or Marius will have an answer for you.

I believe the tags code can be found in the footer section of the loop-single.php file. This loads a function for the tags, which calls the meta array.

You can’t just call array and change to search since the data being pulled is from dbase and part of the core WP functions, not “created” by the theme.

Post count: 4

Hi Christopher,

Thank you again, i’ll hope for Lucian or Marius to reply then.

I’ve searched hours for this, can’t find a solution.

Thanks

Post count: 388

Can a plugin like Redirection do variables / stems of URLs, or only individual whole URLs? Could possibly help. https://wordpress.org/plugins/redirection/

Or clever .htaccess rewriting? But I’ve never really tried this myself. https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Post count: 1291

Hi,

You can modify the td_module_blog.php file like this – http://screencast.com/t/5bTu0Hea

$buffy .= '<li><a href="http://0div.com:60/wp_009/?s=' . $tag->name . '">' . $tag->name . '</a></li>';

Replace the url with your own.

Thank you, Emil G.

Post count: 4

Hi Emil G,

Worked perfectly, thank you so much.

Post count: 9544

Official support is sometimes the best support ! 😉

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.