• Resolved tom1899

    (@tom1899)


    This may be a simple answer, but I’m a little confused.

    My taxonomy terms are “Position Open” and “Position Closed” – these refer Job descriptions and whether we are hiring for a position.

    I am using a Custom Post Type with Custom Fields and the Taxonomy shows up in a Meta Box to the right of the Custom Fields.

    I can sort by Taxonomy on a page I created. So the taxonomy works.

    Within each position description – I call the post_meta: job_status.

    It works but posts the ID of the taxonomy (38 for open, and 39 for closed). I don’t know how to get it to post the Taxonomy Names: “Position Open” and “Position Closed”

    Could someone point me in the right direction?

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Sounds like you’re probably storing the term ID as this meta value, so you’d then want to make use of something like this:

    // Get term by id ('term_id') in taxonomy.
    $term_id = get_post_meta( get_the_ID(), 'job_status', true );
    $term = get_term_by('id', $term_id, 'category');
    echo $term->name;

    Make sure to change “category” to your actual taxonomy slug.

    Thread Starter tom1899

    (@tom1899)

    Michael – I’m not really a developer – so I’m not intentionally storing anything. Just trying to use the tools – it’s giving me a result I don’t want. Hahaha.

    Where do I add this code?

    Also – why would the tool not do this by default? It seems like that should be an option?

    Thanks!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Noted on you yourself not being much of a developer, but someone set things up here and based on what little I have, I have to assume that I’m on at least a slightly correct path here.

    Regarding where it goes, that’s going to be where the output is expected and with what template is handling that output. I don’t know any details on that front myself.

    Regarding why this isn’t automatically handled in some way is that we don’t handle anything regarding display of information or the content that gets created with the content types. There’s infinitely too many ways that it all could possibly get used and we couldn’t provide anything at that scale.

    Thus why we focus CPTUI on doing a small but important job and doing it as well as we can: getting the content types registered with the values provided. We let others do what they will with it from there.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CPT-UI: How to get Taxonomy Term to appear in post.’ is closed to new replies.