Hello,
I would like to use a taxonomy archive (years) to automatically display older posts of a custom post type. This older posts should be grouped by another taxonomy (categories).
I managed to create a grouped view with the help of the following documentation https://toolset.com/2015/07/how-to-group-posts-by-category/.
The taxonomy archive for years should look just like it, but just show the posts of one year. How can I achieve that?
Thank you in advance and kind regards
Sean
Grouped view: hidden link
Taxonomy archive example: hidden link
Hello,
It is possible, but it might conduct some other unexpected results, for example:
- the pagination/AJAX search of year archive page won't work any more
- there is known issue to display taxonomy view in archive page, for example:
https://toolset.com/errata/content-template-is-not-rendered-if-added-outside-the-archive-loop-of-a-view/
- The parent "categories" taxonomy will outputs all terms of categories, and the child post view might display the result: no item found.
And you will need to setup custom codes to add year filter to child post view:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
So my opinion is not to go.
Hello Luo Yang,
thank you for your answer.
So you say that I shouldn't try and output grouped posts with a year taxonomy archive?
I thought that this would be the smartest way because WordPress already automatically generates taxonomy archive pages for each year. What would you suggest instead?
I could always create a filtered view for each year, but this wouldn't be as automated as using the year taxonomy archive pages.
Kind regards
Sean
Yes, my opinion is this is not a good idea to group results in year archive page, since it will conduct a lots of unexpected result.
And you are right, in the archive page, the results are outputted from WordPress core, you can use Toolset WordPress Archive to style/format and filter the results:
https://toolset.com/course-lesson/creating-a-custom-archive-page/
But it can not group result by taxonomy "categories"
Hello Luo Yang,
OK thank you for your help. Then I'll create filtered grouped views for each year.
Kind regards
Sean