Pinboard Theme, Trying to add a category block to my post

Viewing 5 posts - 1 through 5 (of 5 total)
  • #15290
    JL
    Participant

    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!

    #15329
    Daniel Tara
    Keymaster

    There is no easy way to do that, I’m sorry.

    #15337
    JL
    Participant

    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 );
    }

    #15348
    Daniel Tara
    Keymaster

    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.

    #15353
    JL
    Participant

    Thank you again.

Viewing 5 posts - 1 through 5 (of 5 total)

Tagged: ,

You must be logged in to reply to this topic.