Is there a way to get the name of the category and the link to the category page separately inside the wordpress loop. I don’t have the id of the category either and I wanna display images instead of category names therefore the_category() doesn’t work for me.
Thanks
Appreciate all the answers..
get_the_category()
works in THE LOOP. Using this you will get array of category object for each post the loop is currently processing. example :now you can iterate through each category, like so
You can use:
Or:
With get_the_category() you get the category, and with get_category_link() you’ll get the Link of the Category.
In loop
I think Strateg’s code should be changed like so:
the $category should be $categories, then it works for me
This code is good except you forgot to put another ; at the end of the link
should be