Skip Navigation

[Resuelto] Condtional Labels Outside Loop For CPTs in Loop

This support ticket is created hace 5 años, 8 meses. 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)

Etiquetado: ,

Este tema contiene 1 respuesta, tiene 2 mensajes.

Última actualización por Luo Yang hace 5 años, 8 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#1222020
view-cpt-conditional-outside-loop.JPG
Example-of-conditional-line.JPG
conditional-line-only-shows-when-inside-loop.JPG

Tell us what you are trying to do?
I have a CPT that list product specs, and a view to show them side by side in columns, now I need a static column with labels to identify what those specs are, but the labels in this column need to be conditional.

For example, if a product spec is entered for at least one of the CPTs that show in the view, then the corresponding label needs to appear in the static column to identify that spec.

Is there any documentation that you are following?
I've looked, but have not found anything that specifically addresses this. I've started with a single conditional line, but if it's outside the loop, then nothing shows up.

Is there a similar example that we can see?
Yes...

"view-cpt-conditional-outside-loop.jpg" is what I want.

"Example-of-conditional-line.jpg" and "conditional-line-only-shows-when-inside-loop.jpg" are what I tried to see if I could get a result.

Hope you can read my mouse writing.

#1222199

Hello,

Thanks for the details, there isn't such a built-in feature within Views plugin.
shortcode [wpv-conditional] works in one single post, it can not check multiple posts outsider Views loop.

See your screenshot:
enlace oculto

So in your case, I suggest you setup a static column with all specs, and within Views loop

<wpv-loop>
...
</wpv-loop>

Use [wpv-conditional] to check current post has specific custom field, if there isn't display a blank grid.