Tagged: blog posts
I have a blog post component I use for news articles in one of my online sites yet when I try to filter the news by date nothing appears to change and it displays all posts. What I would like to do is create an archive page and add the blog post element with a date range then change the current news blog to be from another date range to now, can any one aid me figuring out what I will have to do to get this element feature to work?
Hey Dave,
Thank you for the inquiry.
How did you add the filter? By default, posts are sorted by published date and if you want to sort them based on a range of dates, you have to use the date_query parameter with the before and after dates.
// https://developer.wordpress.org/reference/classes/wp_query/#date-parameters
Best regards,
Ismael