Home Forums Front-end Issues Display value for taxonomy term text in categories


Display value for taxonomy term text in categories

  • Hello,

    Thanks for this amazing plugin ! I have one problem. I use Taxonomy Term in category with text field. I have the field in back office but I don’t know they can’t display value in front.

    I use this <?php get_field('petite_description_cat');?> but nothing happen…

    my filed

    Can you help me ?

  • Hi @wecandoit

    To show the custom field value from a taxonomy term, kindly follow this guide:

    I hope this helps 🙂

  • I ever triyed to follow this tuts but it doesnt work or i dont understand all… By the way I m french :s

    I just wanna display petite_description_cat on each category if petite_description_cat is here.

    Any idea ?

  • Please can you explain me more ?

  • Hi @wecandoit

    The code depends on where you assign the custom fields.

    Based on your previous code, the code should have this structure:

    <?php echo get_field('petite_description_cat', '$taxonomy_$termID');?>

    You can get the $taxonomy and $termID value by checking the URL when editing the term. I’ve attached a screenshot for your reference.

    As you can see in the screenshot, there are taxonomy=categoryand tag_ID=10. So if you assign the custom field to a category with ID of “10”, then you need to do it like this:

    <?php echo get_field('petite_description_cat', 'category_10');?>

    If you don’t know how to code and don’t have time to learn it, I suggest you hire a developer to help you out.

    I hope this makes sense 🙂

  • Thanks for this help.
    After lot of experimentation i found this
    <?php echo get_field('petite_description_cat', 'category_' . $cat);?>

    And it’s work. I don’t if this method is good but that’s work.

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

The topic ‘Display value for taxonomy term text in categories’ is closed to new replies.