Skip Navigation

[Resolved] Help Using Custom Taxonomies to Create Online Tutorials and Their Navigation

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

Problem: I would like to use a custom taxonomy to organize site content, and I need some advice about setting up pagination, archives, custom URLs and access restrictions.

Solution: See below for some general recommendations, and open separate tickets for each issue so we can discuss in detail.

This support ticket is created 6 years, 2 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by liatG 6 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1095256
Sidebar navigation shows only 1 child term.png
Online Class Chapters Archive Page Layout.png
View 5 loop contents.png
Child Taxonomy Term Archive Page - Example.png
View 5 - Online Class Chapters Filtered by Class Part Taxonomy.png
Class Parts Taxonomy.png

Hiya, this is for Christian Cox, please. He helped me on a support video call and this is a related question.

Hi Christian,
I've started creating the online tutorials using custom taxonomies as we talked about, and I've run into my first set of questions for you about the best way to do it. Here goes:

Below is the hierarchy I'm trying to re-create using custom taxonomies:

Sample Class A <--- not defined yet
Part I <--- parent term from "class part" custom taxonomy
Ch. 1 <--- child term from "class part" custom taxonomy
Online Class Chapter A <--- custom post type "online class chapter"
Online Class Chapter B
Ch. 2
Online Class Chapter C
Online Class Chapter D
Part II
Ch. 3

etc.

To accomplish the above, I created a custom taxonomy for online class chapters called "Class Parts." I created taxonomy terms "Part I," "Part II," etc.
Since I realized that the divisions I'm designating as "Ch. 1," "Ch. 2," etc., are similar to the parts, as they are sub-parts, I created more taxonomy terms as children of the above terms, e.g. "Ch. 1" as a child of "Part I."

See screenshot: Class Parts Taxonomy.

Very quickly I saw that the taxonomy archive pages would be useful as a way of displaying the online classes as well as defining which chapters make up each class. The breadcrumbs make sense out of the box, plus it rendered it unnecessary (maybe) to link each online class chapter to a "Video Knitting Class" (custom post type) through a relationship.

I have some questions about using this setup.

First, I noticed that the archive page for the child taxonomy term makes good sense with a simple view to display each online class chapter in order, filtered by Class Part taxonomy.

See screenshots: View 5 - Online Class Chapters Filtered by Class Part Taxonomy.png, Child Taxonomy Term Archive Page - Example.
On the archive page I see what I want - in the screenshot you can see the first online class chapter and its content, plus part of the second chapter and its content. (Link: hidden link). This is good.
The contents of the loop in View 5 are shown in Screenshot: View 5 loop contents. The page layout includes a header which is the Class Part taxonomy term (see screenshot: Online Class Chapters Archive Page Layout).

However, with this setup, I run into several issues:

1) When I click on the parent taxonomy term (Part I) (link: hidden link), it's ok - it displays all the chapters in order, but I notice right away that:
a) the header it puts at the top is for Ch 2 only (which shows me there is some mistake - it also comes up in the sidebar navigation as well which I'll show you in a second),
b) The page is very long and I don't really want my customers to be able to access this page as it is - I don't think it's useful. Therefore, is there a way to just use the parent terms for navigation and labeling? OR should I make a SEPARATE custom taxonomy for the parent terms, to be able to create a different archive page layout (one that just includes the child term links and maybe a summary for each)? If so, wouldn't I lose the hierarchical, parent-child effect that I need for breadcrumbs and maybe sidebar navigation?

2) On the child term archive page, there is no next/previous post navigation at the bottom of the page, but I would definitely need users to be able to click to the "next term" in the taxonomy, in this case, Ch. 2. Is there a way to create this in the archive page layout itself?

Other questions that I can maybe ask in other tickets but only apply if I do the setup as described above:

3) Protecting the videos: If this is the best general setup, would it be smart to use the taxonomy archive pages as the actual "Video Knitting Class" pages, eliminating the need to connect to the "Video Knitting Class" post type? Right now, the information about which classes relate to which WooCommerce products is stored in fields in the "Video Knitting Class" post type - but I think I can add custom fields to the custom taxonomies, too, so maybe that can transfer over to each taxonomy term? If I do use this idea, would it be smart to make a overarching parent term that would be the actual class name (e.g. "Sample Class A" mentioned at the top of this post)?

4) URL structure (we didn't talk about this in the video call but it's another navigation thing I want to get right): The URL for the taxonomy archive page looks like this: "hidden link." It would make more sense for me and my users if it were *something* like "/my-classes/knitting-superstar/part-i-patterns-and-techniques/ch-1-reading-a-knitting-pattern." Is that possible with some wrangling later, or do I need to take that into consideration now when setting up the relationships/taxonomies?

5) Sidebar navigation: I tried to do a simple nested view for the sidebar navigation widget, but I could only get it to display either Ch. 1 OR Ch. 2, even when on the parent taxonomy term archive page (e.g. Part I) - link: hidden link (see screenshot "Sidebar navigation shows only 1 child term"). The first online chapter shown in the content area layout is "How to Read Knitting Patterns," which is part of Ch. 1. However, Ch. 2 shows up in the sidebar (plus as the header, mentioned above). How to set up the views for the sidebar navigation depends on your answers to my questions above, but I'm asking it anyway here. Also, since ideally I would be using an accordion layout with loops to display all the parts, sub-parts, and online class chapters for this large class (which you said you could help with), should I wait on this for now and just figure out the main structure first? Either way, I couldn't even get a simple one working for myself for now.

Thanks for your help and wisdom,
Liat

#1096136

Hi! I'll give you general information here for each question. For more specific information, please do break these into separate tickets and I will be happy to go into more detail.

1 a) the header it puts at the top is for Ch 2 only (which shows me there is some mistake - it also comes up in the sidebar navigation as well which I'll show you in a second)
Okay this is because you have placed the wpv-post-taxonomy shortcode at the top of the page. That shortcode only works in the context of a post, not in the context of a taxonomy archive. You should use the wpv-taxonomy-archive shortcode as described here: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-archive

b) The page is very long and I don't really want my customers to be able to access this page as it is - I don't think it's useful. Therefore, is there a way to just use the parent terms for navigation and labeling?
If you want to create a custom Layout just for one specific level of hierarchy in this taxonomy, I can provide a custom code snippet that will allow you to apply that unassigned Layout programmatically. This will get around the fact that you can only assign one Layout to an entire taxonomy archive in wp-admin.

2) On the child term archive page, there is no next/previous post navigation at the bottom of the page, but I would definitely need users to be able to click to the "next term" in the taxonomy
This isn't a built-in feature for taxonomy term archives, but I can show you how to set up something using Views and custom term fields. The general idea is you will create a View of these terms filtered by a custom term field like "chapter-order", which is a number applied to each term. The filter will be configured to show terms with chapter-order greater than some number supplied by a shortcode attribute. You will place this View on the archive, and pass the current term's chapter-order number into the View as a shortcode attribute. You'll probably need another View for the "previous" button as well. This task isn't trivial, so I suggest creating a separate ticket to discuss "term pagination" in term archive pages.

3) If this is the best general setup, would it be smart to use the taxonomy archive pages as the actual "Video Knitting Class" pages, eliminating the need to connect to the "Video Knitting Class" post type?
I don't see any inherent problem with this, but you should consider your site content as a whole. If you're planning to show lists of Classes with Views, then all your Classes should be organized the same way. In other words, don't make Video Knitting Class a taxonomy but Audio Knitting Class a custom post type. Be consistent, or you won't be able to show both in the same View. Also consider site URLs, which leads me to the next question.

4) URL structure
Toolset is set up to use the standard URL structure provided by WordPress, and we don't offer much in terms of URL customization with hierarchy and directory structures. There are several other 3rd party plugins out there that are more targeted at URL manipulation, and you'll probably have better luck with one of those than trying to build custom rewrite rules in code.

5) Sidebar navigation: I tried to do a simple nested view for the sidebar navigation widget, but I could only get it to display either Ch. 1 OR Ch. 2, even when on the parent taxonomy term archive page
It seems like this View should be set up as a View of taxonomy terms, filtered by term parent, where the term parent is set by the current taxonomy archive. That would loop over the main chapter terms. Then you could nest inside the Loop another View of taxonomy terms, filtered by term parent, where the term parent is set by the parent taxonomy View. That would loop over the terms within each chapter. If you'd like more detailed assistance here, please do create another ticket.

#1096407

Awesome!! I will work on this and open other tickets for more specifics.
Thank you support hero!

Thank you so much for your advice on 3) and 4)! I will be consistent as you say, and have downloaded a permalink manager plugin (didn't even know that existed) to manipulate the URLs once I have the tutorials all set up.