Skip Navigation

[Resuelto] Featured image from custom field

This support ticket is created hace 6 años. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 1 respuesta, tiene 2 mensajes.

Última actualización por Luo Yang hace 6 años.

Asistido por: Luo Yang.

Autor
Mensajes
#1140640

Support,

Right now I am inputting external URL's into custom fields to pull product images. Is it possible to trigger the featured image of a post from the custom field?

Thanks,
Charles

#1141099

Dear Charles,

I assume we are talking about this case, when user save a post, you are going to use the custom image field value as the post feature image(product image).

If it is, there isn't such a built-in feature within Toolset.

It needs custom codes, here are my suggestion:
1) When user save the post, you can use action hook save_post to trigger a PHP function
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post

2) In this function
- Get the custom image field value
https://codex.wordpress.org/Function_Reference/get_post_meta
- Retrieve the remote image file
enlace oculto
- Save it into wordpress media library
https://codex.wordpress.org/Function_Reference/wp_insert_attachment
- Save the media ID as post feature image(product image)
https://codex.wordpress.org/Function_Reference/set_post_thumbnail

But according to our support policy
https://toolset.com/toolset-support-policy/

this kind of custom codes is out the range of Toolset support, if you need assistance for it, you might check it with our Toolset contractors:
https://toolset.com/contractors/