Support

Account

Home Forums General Issues Display value for taxonomy in template Reply To: Display value for taxonomy in template

  • Hi @kylewallace86

    #2
    When you edit the taxonomy field, you can set the return type setting from ID to Object. The Object will return all the term data from the DB, not just the ID! Please note, you need to use the get_field function to load the value.

    #1
    Create a field group for the term fields (“Required Equipment” and the other “Optional Equipment”) and use the location rules to map this field group to the taxonomy term under ‘Other’.

    Now, when you edit the term, you can save this extra data.

    Now, back to your template. You should be on a single.php or something similar to display the $post. You can load the term like so:

    
    $term = get_field('equipment');
    

    Then you can load the equiptment data like so:

    
    $required_equipment = get_field('required_equipment', $term);
    

    Notice that you can pass the $term object through to the function to tell ACF to load from that object, not from the global $post object.

    Hope that helps.

    Please note that to pass in a $term object, you will need to be using a recent version of ACF (4.3.3)

    Thanks
    E