I am building a taxonomy archive page and I am trying to create a linked instance of the current term outside the loop. So, let's say my taxonomy and current term are:
- Taxonomy: Animals
- Term: Elephants
I want to echo the term Elephants and have the term name linked to the Elephants term archive. So, this would be the output:
Elsewhere I use single_term_title(); and that perfectly grabs the term name for that specific archive page. In other words, I can echo the title fine. I just want it linked to the archive page for that term. In an ideal world, the code that I want would be:
<a href="http://www.mywebsite.com/tag/<?php single_term_slug(); ?>/"><?php single_term_title(); ?></a>
There is no single_term_slug(); and I have tried a number of things, but so far nothing has worked.
Another alternative is that I am trying to echo the permalink for the current page. I have looked into ways of doing it that was as well. Something like get_canonical(); but that does not exist either.
So either the answer is something that I have not found or could not come up with myself... Or it is so darn easy that it is right in front of my face (which could very well be the case).