I’m stuck in a rather simple task: to get the category title for the current post, within the loop, to be used in the function (not to be automatically printed). Any ideas?
Leave a Reply
You must be logged in to post a comment.
I’m stuck in a rather simple task: to get the category title for the current post, within the loop, to be used in the function (not to be automatically printed). Any ideas?
You must be logged in to post a comment.
The function
get_the_category()
returns an array of category objects. To get the name of the first category, use this:For a list of the properties of the category object, see the documentation on
get_the_category()