Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.
Problem:
How to display conditional button
Solution:
you can use conditional shortcode [wpv-conditional] to display conditional output.
You have two options - either you should use custom shortcode that returns true or false based on your number of posts count condition or you can return total number of posts counts as per your conditional criteria and return count and with [wpv-conditional] shortcode use the custom shortcode.
I have a Theater Groups directory made with Toolset. There are two User roles: Theater and Group.
The user Group has a CPT group and the CPT "group" has a CPT child "Hiring".
The theater user has a CPT theater and the CPT theater has a CPT child "contract".
That is, the CPT "contract" has two parents "CPT Group" and "CPT theater".
When a theater user logs in, you can see in each group profile a button to create a CPT "contract". That is, when a theater enters the view of a group it creates a CPT "contract" that is child of CPT Theatre and CPT Group.
Up to here everything is correct. What I need is for that button to be shown only if the following requirements are met:
1º- The number of contracts of the group is less than three. Since no group can act more than 3 times.
2º- The number of CPT hired theater tickets is less than three. And also the total number of CPT contracts is less than 45.
In short, the problem I want to solve with this is the following:
There are a total of 45 contracts, 20 theaters and 20 groups. Each theater has to choose a minimum of two groups and each group will have at least 2 performances and a maximum of 3.
This is because 20 theatres x 2 contracts = 40 contracts. Thus all the groups and all the theatres would have 2 contracts. But being 45, there are 5 contracts, which will choose the theaters in order of application, and no group or theater can have more than three contracts.
If someone has another proposal to solve it, I am willing to study it. Thank you.
Hello. Thank you for contacting the Toolset support.
Well - you can use conditional shortcode [wpv-conditional] to display conditional output.
You have two options - either you should use custom shortcode that returns true or false based on your number of posts count condition or you can return total number of posts counts as per your conditional criteria and return count and with [wpv-conditional] shortcode use the custom shortcode.