Hello,
I have a custom field 'end-date' and I want to display a part of the Views only when we have reach this end-date + 2 days.
I have currently a code which is working for end-date = today :
[wpv-conditional if="( $(wpcf-end-date) gte 'TODAY()' )"]
How can I extend this in order to cope with TODAY + 2 days?
Thanks
Pat
Hi Luoy,
Thanks for your feedback.
I'm wondering if I did not make a mistake as it seems that lt would fit better than gte for this case.
(I want the content to be visible 2 days after the end-date) ?
Second point, even with this, I have tried your solution and nothing is displayed (even if I'm changing the end-date). Here is my code :
[wpv-conditional if="( $(wpcf-end-date) lt ('TODAY()' + 24 * 60 * 60 * 2)"][wpv-view name="Engagements concours"][/wpv-conditional]
Any idea?
Regards
Pat
I assume you are going display the content only when:
1) wpcf-end-date is greater than today
2) wpcf-end-date is less than 2 future days
Please try this:
[wpv-conditional if="( $(wpcf-end-date) lt ('TODAY()' + 24 * 60 * 60 * 2) ) AND ( $(wpcf-end-date) gt ('TODAY()') )"]
I want the content to be visible 2 days after the end-date
[/wpv-conditional]
See the live test website:
hidden link
user/pass: xgren/111111
Hi Luoy,
Sorry, I have not been clear.
I want to display the cconditional content only after end-date + 2 days.
So here is my code :
[wpv-conditional if="( $(wpcf-concours-date-limite-inscription) lt ('TODAY()' + 24 * 60 * 60 * 2)"][wpv-view name="Engagements concours"][/wpv-conditional]
I made several test using different end-date and the conditional view is displayed for :
end-date >= today
Ex : taking the current today's date (Feb, 23rd), if I place Feb, 22nd as end-date, nothing is displayed. If I place Feb, 23rd as end-date, then the display is OK !
Any idea?
Regards
Pat
Sorry, I still do not clear the question:
1) I want to display the cconditional content only after end-date + 2 days.
What date do you want to compare?
in your codes:
$(wpcf-concours-date-limite-inscription) lt ('TODAY()' + 24 * 60 * 60 * 2)
It means the custom date field value "concours-date-limite-inscription" is less than today's date + 2 days
2) And I tested it in above test site:
hidden link
setup as end-date as February 22, 2016
and using same codes as you mentioned above:
[wpv-conditional if="( $(wpcf-end-date) lt ('TODAY()' + 24 * 60 * 60 * 2) )" debug="true"]
I want the content to be visible 2 days after the end-date
[/wpv-conditional]
It does output the string:
I want the content to be visible 2 days after the end-date
Could you duplicate same problem in above test site? thanks
Hi Luoy,
I have created a new postyoe in yoru site (concours) and a content view integrated the code :
[wpv-conditional if="( $(wpcf-end-of-subscription) lt ('TODAY()' + 24 * 60 * 60 * 2) )"]Hello, I'm 2 days after the end of subcription[/wpv-conditional]
If I put current date as end-of-subcription date, then, the output is displayed !
Could you have a look on it please
Thanks
Pat
It seems there is a logic error in your codes, if you need display the content depends on:
Today's date is 2 days after the end of subscription, please try this:
[wpv-conditional if="( $(wpcf-end-of-subscription) lt ('TODAY()' - 24 * 60 * 60 * 2) )"]Hello, I'm 2 days after the end of subcription[/wpv-conditional]
If you need to display the content depends on:
the end of subscription is before the day after tomorrow, you can try this:
[wpv-conditional if="( $(wpcf-end-of-subscription) lt ('TODAY()' + 24 * 60 * 60 * 2) )"]Hello, the end of subcription is before the day after tomorrow[/wpv-conditional]
Hi Luoy
Many thanks for your support.
That's OK now and I should have though about this before !!!
Regards
Pat