Skip Navigation

[Resolved] How to display a custom field image from product categories on a template?

This support ticket is created 3 years, 6 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by molnarV 3 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2440355

Tell us what you are trying to do?
I'm using Woocomerce and I made a product archive template to list products in categories. I've created an image type custom field in the product category taxonomy and I can't display it using any shortcode method. I saw a post from a few years ago saying that I would need to create a custom shortcode for this and there was some code to it, which I added to functions.php, but nothing happened.
It would be an enormous help if someone could lay out a detailed set of instructions on how to achieve this.

Is there any documentation that you are following?
No docs for this.
Is there a similar example that we can see?
Couldn't find any

What is the link to your site?

#2440679

Hello,

In the taxonomy archive page, you can get current term ID with shortcode [wpv-taxonomy-id]. and you can use it as Types shortcode attribute "term_id", like this:

[types termmeta="my-image" term_id="[wpv-taxonomy-id]"][/types]

More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
term_id:
"id" - output the field for the term with this id.

#2440769

My issue is resolved now. Thank you!

Hi and thanks for your quick help, eventhough that didn't work for me, lol
This is how I managed to display the image, within a Gutenberg HTML block:

<img src="[wpv-taxonomy-field name='wpcf-my-custom-field-image']">

I'm totally new to Toolset and I'm a nocoder (only HTML/CSS), and I see great possibilities with your framework.
Be prepared for lots more questions 🙂