Skip Navigation

[Resolved] Display child category terms in alphabetical order and then display any posts

This support ticket is created 5 years ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Shane 5 years ago.

Assisted by: Shane.

Author
Posts
#1212671

I want a series of category archive pages that display the children of the current archive category term page in alphabetical order and then display the posts belonging to those terms underneath each term. So for example I have a category term page of USA. When on that page I want to display child terms which will be American states and then under each state display any post that is a member of that term.

#1212773

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Thank you for contacting our support forum.

This is possible if you are creating a custom archive for your taxonomies.

So what you will need to do is create the custom archive for your taxonomy. Create a custom view for your child terms. Create a custom view that lists the posts.

1. Create the Posts view and add a Query filter to it for your taxonomy, then set the filter to "Set by parent taxonomy view"
2. Create the Taxonomy view and add a query filter to it for your taxonomy parent, then set the filter to "Parent is the term of the current taxonomy archive page"
3. Add you Post view to this taxonomy view.
4. In your taxonomy view you will need to add the correct shortcodes to display titles of the taxonomy terms. You can also order the taxonomies in this view by name as well.
5. Add your taxonomy view to your custom archive.

Please let me know if this helps.
Thanks,
Shane

#1213359

Hi Shane,

Thanks for this. This works perfectly for an archive page that has child taxonomy terms such as this page here: (Password: Europa-808)

hidden link

This page has child terms of particular USA states. However, for archive pages that dont have a child term (No states just the main country) nothing is displayed:

hidden link

UK has posts in it but nothing now displays. How do I have these archive pages just display a list of the posts in that parent category without affecting the functionality already created for pages like USA?

Regards,

David

#1213391

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

I see what you mean now, so you want the posts to display even if there are child terms.

I think I have a solution for this. You will probably need to create a 2nd Post view and add it to the "No Results Found" section of the taxonomy view.

On the Post view you will add the filter for the taxonomy and set it to get the taxonomy from the current archive page.

Please let me know if this helps.
Thanks,
Shane

#1213409

Hi Shane,

That's great and works well. Finally, how can I get the parent taxonomy term to appear at the top of the page, so for UK it says 'UK' for USA it says 'USA' etc.

David

#1213438

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Ok so for this you just need to put the shortcode [wpv-taxonomy-title] in the custom archive, outside the loop output.

Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.