[Resuelto] Conditional for images with permission for multiple instances of the field
This support ticket is created hace 8 meses, 1 semana. 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/Karachi (GMT+05:00)
Este tema contiene 5 respuestas, tiene 3 mensajes.
I need to create a conditional for an image field with the active option to have more than one instance. I need to know if the field is empty or has an image.
He añadido el código personalizado y al añadir el shortcode en la vista siempre devuelve 0.
add_shortcode('get-image-field-count', 'get_image_field_count_fn');
function get_image_field_count_fn() {
What is the context where you are using the shortcode?
The code itself looks okay, assuming that the context is correct for get_the_ID to return the post ID of a post that has values for a custom field whose slug is listing-images.
Maybe try returning the result of get_the_ID() to check it is the value expected.
El contexto es que quiero una condicional para saber si un campo de imagen fuese repetible (activada la opción: ¿Campo único o se repite? Permitir varias instancias en este campo) De este modo, si el campo no contiene ninguna imagen no cargará nada.
[wpv-conditional if="( $(wpcf-listing-images) ne '' )"]
Image field is not empty!
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-listing-images) eq '' )"]
Image field is empty!
[/wpv-conditional]
That is the basic conditional for an image field with the conditional for a single image. If you see the code I have sent and the explanation above, what I need is a conditional for when the image field has the option enabled to make it a field to add more than one image. The option in the field configuration is: Allow multiple instances in this field
What is the conditional for this type of field?