Skip Navigation

[Resolved] Conditional Output for Editor Field/Box

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by paulS-17 7 years, 10 months ago.

Assisted by: Nigel.

Author
Posts
#482503

I need to display a conditional message in my Content Template if the Editor field is empty. My staff custom post types have custom fields for tile/email/location/department. The post title is the persons name and the editor field contains their biog.

I need to display wording saying 'Sorry but [wpv-post-title] has not entered any personal details yet!' if there is no content in the editor field.

I have tried:

[wpv-conditional if="( $(wpv-post-body) eq '' )"]Sorry but [wpv-post-title] has not entered any personal details yet![wpv-post-body view_template='None'][/wpv-conditional]

But this displays the message on all members pages and does not differentiate between and empty Editor field.

#482702

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Paul

The wpv-post-body shortcode isn't available in the dropdown of Views shortcodes when using the conditional output button on the editor to insert the conditional shortcode.

That shortcode has a special purpose in Views, because it doesn't just output the post body, but is used to determine the Content Template used when outputting a post.

So I tested the following and found it works:

[wpv-conditional if="( '[wpv-post-body view_template='None']' eq '' )"]
<p>Sorry, no content here</p>
[/wpv-conditional]

Try that, and let me know if you have problems with it.

#482766

Thanks Nigel, that seems to work perfectly for this exercise. Saved me pulling out what little hair I have left 😉

The forum ‘Types Community Support’ is closed to new topics and replies.