I am using a View to display the latest GRADE (CPT) in another view.. Everything works perfectly.
The last touch is to have those cells get the class of "late" if the post date of that grade is older than 90 days ago..
So far I have this:
[wpv-conditional if="( '[wpv-post-date]' lt 'MONTHS_FROM_NOW(-3)' )"]
<td class="late">[types field="session"][/types] [types field="year"][/types]</td>
<td class="late">[types field="gpa"][/types] / [types field="gpa-total"][/types]</td>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-date]' gte 'MONTHS_FROM_NOW(-3)' )"]
<td>[types field="session"][/types] [types field="year"][/types]</td>
<td>[types field="gpa"][/types] / [types field="gpa-total"][/types]</td>
[/wpv-conditional]
But I suspect the MONTHS_FROM_NOW( ) function doesn't work here..
How should I go about it?
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Yes - you can use the MONTHS_FROM_NOW(-3) as this will return the timestamp of the date from the current date timestamp minus 3 months.
So, the only change you need to make is you need to compare the publish date's timestamp. You can get the publish date timestamp by using the format attribute. For example: [wpv-post-date format='U']
For example:
[wpv-conditional if="( '[wpv-post-date format='U']' lt 'MONTHS_FROM_NOW(-3)' )"]
<td class="late">[types field="session"][/types] [types field="year"][/types]</td>
<td class="late">[types field="gpa"][/types] / [types field="gpa-total"][/types]</td>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-date format='U']' gte 'MONTHS_FROM_NOW(-3)' )"]
<td>[types field="session"][/types] [types field="year"][/types]</td>
<td>[types field="gpa"][/types] / [types field="gpa-total"][/types]</td>
[/wpv-conditional]
More info:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-date
Wow, so easy, I'd not seen that -U switch. Ohh it's the UNIX timestamp. W00t!
My issue is resolved now. Thank you very much!!