Skip Navigation

[Resolved] Custom Post Archive Sorted by Custom Date AND Include Posts Without a Date

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#479968

I am trying to create a custom post archive that is sorted by date. The date will be pulled from a custom post field. I believe this part is easy.

However, I would also like to include custom posts that do not have a date input into the custom post field.

I want these listed at the end after the custom posts that are returned with a date.

How would I do that?

#480171

Dear Chris,

I suggest you create a view to list posts, and use Views filter hook "wpv_filter_query" to add the custom filter exclude posts which are within a specific date range.
And put above view into the wordpress archive page, at the end after of main content.

See our document:
wpv_filter_query
DescriptionWhen displaying a View listing posts, this filter is applied to the arguments being generated by the View settings before they are passed to the WP_Query class.
https://toolset.com/documentation/user-guides/views-filters/#wpv_filter_query

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.