WP shortcut for post page

asked Dec 12, 2012 in Website Builder by SunFun

My WordPress blog post has a keyword that is linked to tag an archive page. I need to add a tag page link manually, I want to make a shortcode for post page, so that it would directly link back to the tag archive page in the keyword. So for example if I have [Anything] or [tag]Anything[/tag] or [Tag=Anything] then ‘Anything’ text will link to the ‘Anything’ tag archive page.
I would really appreciate any help in this
Many thanks

1 Answer

0 like 0 dislike
answered Dec 12, 2012 by expert
Try this code
function your_tag_link($atts,$content) {
$url = home_url('/');
   $yourtarget = your_title_with_dashes($yourcontent);
   $link ="<a href='{$url}tag/$yourtarget'>$yourcontent</a>";

   return $link;