Skip Navigation

[Closed] Taxonomy based loop to create accordion with Taxonomy's name

This support ticket is created 3 years, 7 months 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Luo Yang 3 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1784463

Tell us what you are trying to do?

I want to create a view which is creating accordion based on taxonomy.
For example: Created taxonomies named A, B, C ...
In this case will have 3 accordions - A, B and C.
On expand of each - they will dynamically show content from the Custom post type with its fields based on taxonomy from current taxonomy.

Please advice how to create the loop based on taxonomy and to add it in dynamic accordion.
Thanks.

#1785293
Screenshot 2020-09-22 at 10.46.24.png
Screenshot 2020-09-22 at 10.40.02.png
Screenshot 2020-09-22 at 10.40.54.png

Update:
I have managed to create the accordion loop based on taxonomy category creation of my CPT.

Added my View to - Content Selection - Taxonomy and in the loop editor - added the code for accordion and it worked (please reffer to the screenshot attached). Now each time a new category for Region is created it will dynamically add new accordion tab.

Now I need to figure how to pull the correct posts based on a category of the "Region" taxonomy in each accordion.

For example I created new posts in my CPT:
Post 1 - Category A
Post 2 - Category A

Post 3 - Category B
======================================
My View created 2 accordion tabs - A and B
So Post 1 and Post 2 need to go in Accordion tab A
And Post 3 need to go in Accordion tab B
======================================

I have attached a screnshot of the custom fields which I have created for my CPT.
Please advice me what code should I put between the panel-body div in my Accordion Views Loop - for my posts to be displayed in the specific category-based accordion tab.

Basically it needs to be user-friendly CPT:
1. Create a new post, add content to the custom fields, assign category to category "Region 1" (which is already there) - it will place it in this category accordion on the front end.
2.Create a new post, add content to the custom fields, assign NEW category "Region 2" - this new category will dynamically be added as a new accordion tab in the front end (which is now solved) and the new post will go there.

Thanks.
Kind regards.

#1785425

Hello,

What kind of accordions are you using? can you provide a live demo for it?
For example, Bootstrap Collapse, it needs a unique ID for each accordion:
hidden link
You can use term slug as the unique ID
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153465

#1785729

Hello, these are bootstrap accordions I believe, please refer to my attached screenshot from last post.

I think that issue is resolved with accordions creation.

Just left to configure the right posts to go to right accordion tabs as I explained from my post above. Please check it as I descibed the situation there with examples.

Thank you.
Kind regards.

#1786947

Please provide a test site with the same problem, fill below private message box with test site credentials, also point out the problem page URL and view URL, I need to test and debug it in a live website

The topic ‘[Closed] Taxonomy based loop to create accordion with Taxonomy's name’ is closed to new replies.