Skip Navigation

[Résolu] not display wpv-post-body if empty

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
How to check post body is empty.

Solution:
Using [wpv-conditional] shortcode you can able to display conditional output.

To display post body if post body is not empty, please try following example:

 
[wpv-conditional if="( '[wpv-post-body view_template='None']' ne '' )"]
Here is some more info:
[wpv-post-body view_template="None"]
[/wpv-conditional]

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/

This support ticket is created Il y a 8 années et 1 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 réponses, has 3 voix.

Last updated by davidL-20 Il y a 8 années et 1 mois.

Assisted by: Minesh.

Auteur
Publications
#373599

Hi Minesh,
I'm trying to test on a content template if the user fills out the regular content box or not. If they do I would like to display "Here is some more info:" along with what has been inputted into the WP content box.

I thought this code would work but it does not. Can you help?

[wpv-conditional if="( '[wpv-post-body]' ne '' )"]
Here is some more info:
[wpv-post-body view_template="None"][/wpv-post-body]
[/wpv-conditional]

Thanks,
Ronald E.

#373851

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Could you please try following code:

[wpv-conditional if="( '[wpv-post-body view_template='None']' ne '' )"]
Here is some more info:
[wpv-post-body view_template="None"]
[/wpv-conditional]

I hope above solution will help you to resolve your issue.

#374025

Thank you Minesh. That works as expected.

To note, I was using the conditional output button to generate the code. Under Data origin when I select Views Shortcodes I can only select "wpv-post-body" which does not include the "view_template='none'" part.

So just using the Views buttons of Fields and Views and Conditional Output I get this code which does not work.

[wpv-conditional if="( '[wpv-post-body]' eq '' )"]
[wpv-post-body view_template="None"][/wpv-post-body]
[/wpv-conditional]

#459483

Thanks for that solution Minesh as it was exactly what i was looking for!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.