Change Query / Conditional Logic Sequence?

Hi folks,

Check this out:

I’ve got a looper in the psuedo-class footer that goes and collects the next three upcoming classes, sorted from closest to latest (on ACF date field). Works great.

But I don’t want classes that are in the past. So I’ve got a conditional logic on the Post —> if server date is after class date, drop from the compiler. Works great.

As you can see on the Product above, the query runs first (get 3) and then the conditional logic runs second. Is there a way to swap this? Conditional logic runs, then query.

Or maybe there’s a way to embed the conditional logic in the query itself?

(Credentials coming in secure note.)

Also, super fun building these Woo products in Layouts — really elegant. Great job, folks!

Hi @lukefinsaas,

Thanks for reaching out!

I believe you can add the conditional logic in the query string itself. The challenging part here is to know the right query to show the post that end later than today. That being said, I suggest that you check these documentations.

Please also refer to this thread on how you can write your query string.

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.