Skip Navigation

[Resolved] Conditional fields appearing with PHP?

This support ticket is created 5 years, 1 month 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)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1365645

Hi Team,

I would like to use Pages to act as various templates, but because each template will have different types of custom fields, is there a way to conditionally hide them at the PHP/server level so that the custom fields do not even get rendered (then hidden)?

I have hundreds of custom fields and the performance of loading each page with all of the custom fields loaded, but then conditionally hidden by CSS or other methods seem to be cumbersome.

Is there a way to do this at the backend/code/server level via PHP so that they don't even get rendered on the frontend unless we configure it to?

Please let me know if this makes sense, or if you have any questions. Thanks!

#1366017

Hello,

I suggest you try the [wpv-conditional] shortcode to display/hide those specific custom fields, see our document:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Conditional HTML Output in Views

This shortcodes works as other WordPress shortcodes in server side.