Some things with sorting and conditions with ACF posts

Hi,

I set a CPT and fields with ACF to generate a calender and news items from the same posts. When added a featured image and text it is also a news item, without it is only a comming event in the calender.

I can filter the data for latest news items and upcomming events perfectly with those Query strings in the Looper provider:
Latest 3 news items:
post_type=event&orderby=meta_value&meta_key=datum_van&order=dsc&meta_query%5B0%5D%5Bkey%5D=datum_van&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format=“Ymd”}}&meta_query%5B0%5D%5Bcompare%5D=%3C%3D

and
Upcomming events:
post_type=event&orderby=meta_value&meta_key=datum_van&order=asc&meta_query%5B0%5D%5Bkey%5D=datum_van&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format=“Ymd”}}&meta_query%5B0%5D%5Bcompare%5D=%3E%3D

As seen here: https://lapauline.nl/wp/
(Laatste nieuws and Volgende events)

In the calender here: https://lapauline.nl/wp/events/
Only the Events in the past or featured image set or content field (verslag-van-event) in ACF, has to link to the single post, others no link.

On the news page, all items are perfect sorted on today and in the past also with
post_type=event&orderby=meta_value&meta_key=datum_van&order=dsc&meta_query%5B0%5D%5Bkey%5D=datum_van&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format=“Ymd”}}&meta_query%5B0%5D%5Bcompare%5D=%3C%3D

But when on a single post item, the next and previous post navigation is going thru all posts and the posts in the future or featured image is not set or content field is empty (verslag-van-event) should not be shown with navigating with the next and previous post navigation.

How can I filter on one (or more) of those rules?

And the single posts should be sorted on an ACF date field (datum_tot) and not on publish date.

Can you help me with this please?

THX, Carel

Hello Carel,

Thank you for the very detailed post information. What you are trying to do requires custom Coding. Please check out this article instead to fully understand the behind-the-scenes of the next and previous buttons.

Be advised that custom CODING is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Best Regards.

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