Skip Navigation

[Resolved] Group Posts in Taxonomy Archive (years) by other Taxonomy

This thread is resolved. Here is a description of the problem and solution.

Problem:

Group the result in WP year archive page by category.

Solution:

There isn't such kind of built-in feature within Toolset, and it might conduct some other unexpected results, for example:

https://toolset.com/forums/topic/group-posts-in-taxonomy-archive-years-by-other-taxonomy/#post-1734041

So my opinion is not to go.

Relevant Documentation:

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 4 replies, has 2 voices.

Last updated by larsP-2 1 month, 1 week ago.

Assigned support staff: Luo Yang.

Author
Posts
#1733481

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

#1734041

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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.

#1737641

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

#1738227

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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"

#1738655

Hello Luo Yang,

OK thank you for your help. Then I'll create filtered grouped views for each year.

Kind regards
Sean