Skip Navigation

[Resolved] Taxonomy image with custom field in a taxonomy file

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to display their taxonomy term meta from a php template.

Solution:

The correct code to use here is.

echo types_render_termmeta( "my-image-field", array() );

Where my-image-field is the slug of the field that was created in Types.

For further details on this you can have a look at our documentation below.
https://toolset.com/documentation/customizing-sites-using-php/functions/#image

This support ticket is created 3 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by ericK-4 3 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#2196121

I made a custom field image on a taxonomy for a product custom field
How can I display this image on my taxonomy.php file
This file display at the top of the page the image and the name of the taxonomy

 <div class="col-md-6 col-sm-12 d-flex align-items-center">
<div class="icon-header-archive">/// the place for taxonomy image /// </div>
<div class="ps-2 ps-md-4 flex-grow-1"><?php the_archive_title() ?></div>
</div>

Thanks for your support

#2196249

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Eric,

Thank you for getting in touch.

Essentially you want to display this image that you've set on the taxonomy correct?

If so then you can do it by using the code below.

types_render_termmeta( "my-image-field", array() )

Where you will replace the my-image-field with the slug of your actual image field. Secondly for the array portion you can pass any of the following parameters you see in the document below into the function.
https://toolset.com/documentation/customizing-sites-using-php/functions/#image

Thanks,
Shane

#2196655

Hi Shane,

I make this but it returns nothing 🙁

<?php types_render_termmeta( "icone", array("output" => "raw", "width" =>"200") ) ?>
#2196801

My issue is resolved now. Thank you!