1

This question already has an answer here:

How can I get all the year of posts in archive.php and put it on the list?

2016 | 2017 | 2018

And after clicking any year, It will show the posts of the selected year www.example.com/post_type/2018.

Do I need to rewrite rules to make this done?

marked as duplicate by Krzysiek Dróżdż, Jacob Peattie, cjbj, Andy Macaulay-Brook, Jack Johansson Jul 10 '18 at 9:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • For built in posts or for your custom post type? – Krzysiek Dróżdż Jun 30 '18 at 10:20
  • 1
    @KrzysiekDróżdż, for my custom post type – Nikko Dela Cruz Jun 30 '18 at 11:17
  • @KrzysiekDróżdż, I am asking about the year only not the month – Nikko Dela Cruz Jul 1 '18 at 13:26
-1

You can achieve this by Using Simple Yearly Archive Plugin. It allows you to use different shortcode based on your requirements.

For custom post type you can use like: [SimpleYearlyArchive type="yearly_past"]

Plugin link: https://wordpress.org/plugins/simple-yearly-archive/

Not the answer you're looking for? Browse other questions tagged or ask your own question.