I created a simple function to display the latest posts. Inside the function there is a conditional to display the post category. I found that to display the category name, using
$category = get_the_category($post->post_ID); $category->cat_name; // I want to display only the first category
do the job, but can't find how to display the link to the category. Tried to use
get_category_link($post->post_ID) but no changes, the link still redirects to the current page. The goal is to redirect to category archive.
Appreciate any help.