Skip Navigation

[Closed] Conditional display of custom field content

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
- 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 3 replies, has 2 voices.

Last updated by Luo Yang 1 year, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2405849

Morning, I have a custom field setup for Woocommerce Products that should only display if the field has a value. If there is no value, the field should not output anything to the front-end of the site. The field in question is called "View Product Specifications" and creates a URL link to 3rd party website page.

Sample page that has no value in the field:
hidden link?

What i used below:

[wpv-conditional if="( NOT(empty($(wpcf-product-specifications-url))) )"]<a class="specs" href="[types field='product-specifications-url' output='raw'][/types]" target="blank" rel="noopener">View Product Specifications</a>[/wpv-conditional]

#2405873

Hello,

What page builder are you using?
Since [wpv-conditional] is a shortcode, you need to put it into a pure text widget, if you are using WordPress built-in Blocks editor, please try Shortcode block:
https://wordpress.org/support/article/shortcode-block/

#2405975

Hi, I am using Divi Builder. I tried the "Text" and "Code" module but didn't have any effect. Still get the same display as before

#2406731

Did you install Toolset Blocks/Views plugin in your website?
[wpv-conditional] is a shortcode of Blocks/Views plugin, you can download them here:
https://toolset.com/account/downloads/

And I assume the problem URL you mentioned above is a single product post, you can follow our document to customize the single product post:
https://toolset.com/course-chapter/templates-for-single-product-pages/

More help:
https://toolset.com/course/custom-woocommerce-sites/

The topic ‘[Closed] Conditional display of custom field content’ is closed to new replies.