Taxonomy Term Archives showing Entries Grouped By Another Taxonomy
This members-only tutorial provides the steps to display products on industry
taxonomy term archives grouped by focus_area
, another taxonomy whilst using Splide to arrange the products as a slider in Oxygen.
We shall get all the focus areas, loop through them, and for each write a couple of custom queries for pulling products that have been assigned the current taxonomy term (industry) and the current focus area in the loop.
Two custom queries are needed because we need to get a fixed number of products (8 in this example) for the slider w/o pagination and the second query is for getting the total number of matching products (shown next to the focus area heading in small text).
The above is a screenshot of example.com/industry/chemicals/ where chemicals
is the industry
taxonomy term for product
CPT.
Conveying, Granulation / Sieving / Milling, Mixing Technology etc. are terms of focus_area
which is another taxonomy for the product
post type.
Step 1
Register Splide script so it can be enqueued later in the taxonomy term archive Template.
Install and activate My Custom Functionality plugin.
Connect to your hosting account using a FTP client and navigate to site's /wp-content/plugins/my-custom-functionality-master
.
Upload splide.min.css to the plugin's assets/css
directory.
Upload splide.min.js to the plugin's assets/js
directory.
Edit plugin.php
and add the following inside the custom_enqueue_files()
function:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.