Tell us what you are trying to do?
I am trying to display a View using 2 different conditional output statements in the same content template.
I have created Courses. Each course uses custom fields. Some courses are OPEN or CLOSED. CLOSED courses have the registration button hidden. See example here: hidden link.
Now I want to add a new custom field so client can choose to SHOW or HIDE a course when the date has passed. My thinking is that I would set this up the same way I did for the registration button. But, It seems as though I can't use 2 conditional statements in the same content template, and I can't nest the conditional statements either.
Here is what I did for the register button:
<div style="margin-bottom: 25px; background-color: #fff; border: 1px solid #ddd; padding: 25px 30px; font-size:14px">
<h5 style="font-size:24px; text-align:center">[wpv-post-title]</h5>
Date(s): [types field="course-dates"][/types]<br>
Faculty: [types field="faculty-name-title"][/types]<br>
Location: [types field="course-location"][/types]<br>
Venue: [types field="course-venue"][/types]<br>
Cost: [types field="course-cost"][/types]<br>
Pay Deadine: [types field="payment-deadline"][/types]<br>
CMEs: [types field="cmes"][/types]<br>
Status: [types field="course-status"][/types]<br>
[wpv-conditional if="( $(wpcf-course-status) eq 'open' )"][types field="course-registration-url" title="Register" class="extra-class" style="display: block; margin-top: 10px; padding: 10px 25px;background-color: #49adde; color: #fff; text-align: center;"][/types][/wpv-conditional]
</div>
What I need help with:
Either a work around so I can SHOW a course based on date AND hide the registration button if the course is CLOSED -or- A way to have the courses automatically expire (and be removed from the View) based on a date reference.
Is there any documentation that you are following?
Nothing available for this
Is there a similar example that we can see?
No
What is the link to your site?
hidden link
Hello,
For your questions:
Q1) SHOW a course based on date
You can edit the view, add a custom field filter on the date filed "course-dates", for example:
Select items with field: Course dates is a UNSIGNED greater than TODAY()
See our document:
https://toolset.com/documentation/user-guides/date-filters/
Q2) hide the registration button if the course is CLOSED
You can modify your codes from:
[wpv-conditional if="( $(wpcf-course-status) eq 'open' )"] ... [/wpv-conditional]
To:
[wpv-conditional if="( $(wpcf-course-status) eq 'open' ) AND ( $(wpcf-course-dates) lt 'TODAY()' )"] ... [/wpv-conditional]
and test again
More help:
https://toolset.com/documentation/beyond-the-basics/conditionally-show-content/#strike-through-event-dates-that-have-passed