JLParticipant
Trying to add a category block to my post. Is there a way to display the category on the front page with the post? similar to this page http://www.exhibitoronline.com/topics/
If I sort by Categories drop down menu on my site the association is already there since I set the category in my posts. Please provide code and where it should be placed.
Thank you!
There is no easy way to do that, I’m sorry.
JLParticipant
Thank you for your response, is there a way to just include the category in the post maybe above the Title? I understand some CSS would be involved and I could handle that part.
I found this online showing how categories are retrieved, and then additional information is retrieved for each category. What I’m not sure is where to paste this code within the Pinboard files.
$post_categories = wp_get_post_categories( $post_id );
$cats = array();
foreach($post_categories as $c){
$cat = get_category( $c );
$cats[] = array( ‘name’ => $cat->name, ‘slug’ => $cat->slug );
}
You just need to use the function the_category(). Try pasting it above the <h2 class=”entry-title”> tag. You’d still need to do some CSS adjustments.