Problem: I have a Form that creates posts. If a certain number of posts have been created, I would like to hide the Form.
Solution: Use a View to count the number of results. Use a conditional inside the View to show or hide the Form based on that number of posts.
[wpv-layout-start] [wpv-items-found] [wpv-conditional if="( '[wpv-found-count]' lt '3' )"] less than 3 posts found - include the Form shortcode here [/wpv-conditional] [wpv-conditional if="( '[wpv-found-count]' gte '3' )"] number of posts is greater than or equal to 3, do not include the Form shortcode here. [/wpv-conditional] <!-- wpv-loop-start --> <wpv-loop></wpv-loop> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found]no posts found - include the Form shortcode here[/wpv-no-items-found] [wpv-layout-end]
Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-found-count
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 4 replies, has 2 voices.
Last updated by 5 years, 4 months ago.
Assisted by: Christian Cox.