I want to add a back button that goes to the parent category of the actual single post that the user is viewing. How can I do that?
<h2 class="link"><a href="#">Return</a></h2>
Thank you.
I want to add a back button that goes to the parent category of the actual single post that the user is viewing. How can I do that?
<h2 class="link"><a href="#">Return</a></h2>
Thank you.
You must be logged in to post a comment.
You can use get_the_category() and return the first result as in the example. Technically you could have several parent categories so you need to deal with this separately or expect that the first element of the array is always the right parent category.
Paste this code in
single.php
according to your theme styleOutput HTML form this code:
Important Link:
get_the_category
This should work!