Sauter la navigation

[Résolu] conditional test of the post content in my custom field

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

Problem:

I am having an issue trying to output a phrase instead of empty content when the body (content) of my custom post is empty.

Solution:

To check whether the content is empty and output the desired phrase, refer to the following documentation:

Relevant Documentation:
https://toolset.com/forums/topic/conditional-output-if-the-post-content-is-filled/

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

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par martinE-4 Il y a 2 années et 3 mois.

Assisté par: Christopher Amirian.

Auteur
Publications
#2556881

Tell us what you are trying to do?
Trying to output a phrase instead of empty content when the body (content) of my custom post is empty

Is there any documentation that you are following?
Just trying to use the wpv-conditional in legacy views:

Here is what I am trying and it is displaying nothing:

 [wpv-conditional if="([wpv-post-body view_template="None"] ne '')"]
     [wpv-post-body view_template="None"][/wpv-conditional]
       [wpv-conditional if="([wpv-post-body view_template="None"] = '')"]
      No abstract available but the full text is online at the title link below.[/wpv-conditional]  

The shortcode:

[wpv-post-body view_template="None"]

on its own seems to work fine and displays the content ok. Just want to output the phrase "No abstract available but the full text is online at the title link below." when the body is empty.

#2557509

Christopher Amirian
Supporter

Les langues: Anglais (English )

Hi there,

The correct way of checking whether the content is empty is as follows:

https://toolset.com/forums/topic/conditional-output-if-the-post-content-is-filled/

Thank you.

#2557563

My issue is resolved now. Thank you! Thanks for pointing me in the right direction!