I want to make custom time periods in my archive widget. Right now it is sorted by month and with plugins I can change it to months and days and stuff, but I don't want that.

I want to sort the archived posts first between 2008 and 2010, next between 2011 and 2016, and so on. I want to do this in the widget. Is this possible? Maybe a plugin I haven't been able to find?

Thanks in advance.

  • Hello @Jelle - Welcome to the WordPress Development community! Plugin recommendations are considered off-topic here. However, what you ask is possible with custom code - but while displaying pages or posts in two-year increments is simple, the task of actually creating a list of two-year archives is considerably involved, and the best implementation likely requires custom SQL or programmatically modifying a string of HTML. Check out the "How to Ask" page in our help center for a few pointers on the kinds of things which compose questions which work well here – bosco Mar 26 '17 at 2:22
  • It's worth noting that if you manually managed the archive links in a custom menu (Appearance > Menus) instead of creating a widget, you could accomplish your goal with a much simpler plugin which uses pre_get_posts to modify the main archive WP_Query to support showing 2 years of posts per page. If you choose to implement this on your own, be sure to include as much detail as possible in questions here regarding the issue you encounter - what you've researched, what you've tried, and what's happening that shouldn't be. – bosco Mar 26 '17 at 2:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.