Tell us what you are trying to do?
I want the user to pick which page this or any content should display on and whither its a single page or multiple pages. I have a custom field of checkboxes each checkbox option value is set to that pages post id. I just can't get my conditional statement to work.
Is there any documentation that you are following?
Not really, I have been looking all over the documentation and forums.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes
Is there a similar example that we can see?
What is the link to your site?
hidden link
Hello and thank you for contacting the Toolset support.
The checkboxes file does not allow to make conditions on multiple values. Currently, we can check if it has a certain value, or if it is empty.
To work around this, you can create a custom shortcode that will check if the post has the current page checked. Check this article https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/
You can use the "$global post" to get the current page. You can use Types shortcode to get the value of the field, and then you can check if the field has the ID of the current page.
For further reading:
- https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/
- https://toolset.com/documentation/customizing-sites-using-php/functions/
Hello Jamal,
I am in a very strict hosting environment, if I could write a shortcode(s) or custom script I would. However I cannot access the actual WordPress directories or files. Which is part of my problem. Would all of you have any suggestions on how I do something similar given these constraints? Maybe a different kind of field?
Thanks!
Hello Stephanie,
I would suggest, creating a many-to-many relationship between your custom post type and pages instead of using a custom field. Check the following articles:
- https://toolset.com/documentation/post-relationships/
- https://toolset.com/documentation/post-relationships/how-to-set-up-post-relationships-using-toolset/
Then, depending, on how you will display these posts on each page, you can create views and use them inside of the pages or their content templates.
This solution won't require any custom coding for a shortcode or function and can be implemented only with the Toolset user interface.
I hope this helps. Let me know if you have any further questions.