Skip Navigation

[Resolved] Hide fields that don’t have an value

This thread is resolved. Here is a description of the problem and solution.

Problem:
I've added about 35 custom post fields but only want those that have a value to be shown on the front end. What is the best way to only show post fields that have a value as opposed to those which are left blank? I'm showing real estate and not every property will have the same fields filled in. It's too hard and time consuming to build it out all based around conditional logic.

Solution:
I suggest you try with Views shortcode [wpv-conditional] to check if the custom field is empty, then display the content you needed.

Relevant Documentation:
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 7 years ago. 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.

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)

Author
Posts
#596403
toolset.PNG

I've added about 35 custom post fields but only want those that have a value to be shown on the front end. What is the best way to only show post fields that have a value as opposed to those which are left blank? I'm showing real estate and not every property will have the same fields filled in. It's too hard and time consuming to build it out all based around conditional logic.

Thank you.

#596596

Dear David,

I suggest you try with Views shortcode [wpv-conditional] to check if the custom field is empty, then display the content you needed, see the document:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/

#597849

Thank you Luo. I was able to figure out how to hide field values. Thank you.