pods display based on date together with [if] [else] conditional statements
-
First of all a very big THANK YOU for this awesome, game-changing plugin.
I have been tinkering with Pods in a recent fairly complex project where I build a web directory of online stores. These forums, as well as the documentation over Pods.io, have provided all I needed and after countless hours of trial and error I always came up with a solution. But not on this last problem I ran into.
I have two pods, “Stores” and “Offers”.
On the “Stores” front-end page, the Pod “Offers” is displayed like a banner towards the beginning of the page.
“Offers” Pod has a custom date field called “expires”.I use
where="CAST(expires.meta_value as DATE) BETWEEN CURDATE() and '2200/01/01'"
to only display “Offers” that are not expired and it works like a charm.However, I want to display a conditional message using
[if]
[else]
statements if there are no offers available but the[if]
statement only checks the presence of a Pod and doesn’t care about dates.
A workaround would be to enclose the[if]
[/if]
statements in an[each]
[/each]
but then for “Stores” that have no “Offers” associated with, the conditional statement is not displayed. The opposite happens if I enclose[each]
[/each]
in[if]
[/if]
statements.Is there a solution to this, or do I have to live with that and maybe create dummy/expired “Offers” pods for the “Stores” that have none currently?
- The topic ‘pods display based on date together with [if] [else] conditional statements’ is closed to new replies.