Back link on post based on current category
-
Hi my wordpress link structure is like this>
https://www.site.com/Category/Pagename
When I’m on “Pagename” I’d like a link that links back to “Category”.
<a href=<?php get_category_link( $category_id ); ?> ><?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?> </a>
I thought this code might work. It displays the “Category” link correctly but links to the current page instead of “Cateogry”.
Anyone know PHP well enough to be able to modify it so the link goes back to “Category”?
I’ve spent hours trying to find a solution in the Codex so this is my last resort.
Thanks.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Back link on post based on current category’ is closed to new replies.