Skip Navigation

[Resolved] Output test based on select box values

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

Problem:

Conditional display contents by custom field values.

Solution:

You can try with [wpv-conditional] shortcode, use it to check field value custom field (select box), then display different result.

Relevant Documentation:

https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/checking-types-fields-and-custom-fields/

This support ticket is created 4 years, 5 months 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 4 replies, has 2 voices.

Last updated by willemP 4 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1680755

Tell us what you are trying to do?
I want to use 4 options that can be set per post.
I created a custom fieldgroup where I added a custom field (select box) with 4 options.
The custom field are used in the posts only so I selected to be used in posts.

Now I want in the frontend in each post a text/html based on the value of each option.
If an option is not selcted I need no text/html
If an option is selected I need custom text/html

I used this shortcode in my post template: [wpv-view name="toon-verkoopkanalen" ids="wpv-post-id"]

Is there any documentation that you are following?
I tried all documentation on toolset site but no answer

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1681707

Hello,

I suggest you try with [wpv-conditional] shortcode, use it to check field value custom field (select box), then display different result.

More help:
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/checking-types-fields-and-custom-fields/

#1681795

1.
Ok. I figured that one out. But is says nothing about select boxes values. So check for multiple values.
How does that work?

2.
Can you explain me why the output with ids="wpv-post-id" gives me "No results found" while when I use the post id directly it gives me the values.

PS
I must say your documentation part is not very user friendly towards basic simple stuff...
Where do you have a simple from start manual about custom fields and settings?
If toolset is meant to be used by non-programmers it's odd the documentation is so complicated.

#1681837

For the question:
Can you explain me why the output with ids="wpv-post-id" gives me "No results found"

Please try to modify your shortcodes from:
[wpv-view name="toon-verkoopkanalen" ids="wpv-post-id"]

To:
[wpv-view name="toon-verkoopkanalen" ids="[wpv-post-id]"]

And test again.

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-id

For the new question:

Where do you have a simple from start manual about custom fields and settings?

Please check our document:
https://toolset.com/course-lesson/creating-custom-fields/

#1682129

The brackets were the issue! I added those [] and now the output is working fine...

Thanks for the other links I will check those out.