Dynamic update of sub categories

Hi, I wonder if you can help me please? I’ve searched the forums for the past few hours but haven’t been able to find the answer yet.

I have created a page that shows a single category - Lifestyle. However, Lifestyle is divided into several ‘sub-categories’ e.g Food, Fashion, Films & TV and Everything Else.

What I’m trying to do is

  1. have sub-category buttons running along the top of the page and

  2. when the visitor clicks on Food all of the Food posts are listed below in a ‘Posts Minimal’ Looper,

  3. from there they can select a post they’re interested in

  4. this opens in a new page with a side menu listing all of the other Food posts

I have managed to set up no4

The problems I’m having is that:

a) I want the sub-category buttons in 1. to update automatically when a new sub-category is added so was thinking of using a Looper for the buttons but haven’t been able to single out the sub-categories from the list.

b) I haven’t been able to single out the sub-categories in the Post Minimal Looper in 2.

c) I haven’t been able to link the button with the posts in 2.

I’m sure this should be ‘do-able’ with Loopers because in the past I’ve used Essential Grid to do something similar with a portfoilo of images, I just want to keep things within Pro rather adding another plugin and style everything within Pro to maintain the look of the site.

Any help would be greatly appreciated.

Best wishes,
Ken

Hey Ken,

For #1, this would require custom development because you need to code your own Custom Looper. My colleague’s provided an example code to display sub-category buttons in this other thread.

Please just note that what has been provided serves only as a guide. You will need to understand the code to be able to use it for your case.

For #2 and #3, I’m not sure if you mean to list the Post Minimal Looper in the same page (Lifestyle category) or in the Sub Category page (Food sub-category). If in the same page, that’s not possible. If in the sub-category page, you will need to create a layout for your sub-category pages. Assignment of the layout to your sub-categories could only be done manually though. That means, every time you have a new sub-category, you need to add it in as one of the OR conditions.

image

image

In summary, what you want to achieve is doable BUT, some parts currently require some custom development.

Best Regards.

Thanks Christian,

I did see the linked post but went round in circles trying to get it to automatically update when adding a new sub-category. It sounds as though I’m going to have to look into custom development further.

Thanks for your time.

Best reagrds,
Ken

You’re welcome, Ken.

Hi,

The links work, thank you but I’ve also found another work around but it’s not 100% and I wonder if you can give any pointers please?

Instead of using the Terms Cloud looper I added a meta looper removing all but the categories and styled these links into buttons. Adding a new category or sub-category automatically populates the looper. I still have to go into the layout builder for them, but it’s part way solved. The current problem I’m facing is the looper shows all categories, not just the sub-categories as in the Terms example provided. Is there a way round this?

Thanks for your time.

Best wishes,
Ken

Hello Ken,

What Looper Provider are you using? If you are using the Looper Provider All Terms that means that all categories will be returned by the Looper. You can try to use the Looper Provider Current Term instead.

We would love to check your custom layout if you wouldn’t mind. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Kindly let us know how it goes.

It’s on the Letters page.

The top row I’m using Meta which updates the category automatically but is showing all categories.
The bottom row uses the custom subcats but doesn’t automatically update the sub-category.

Hello Ken,

Your site is unreachable.

  • See the secure note below

Please double-check.

Hi Ruenel,

A fresh start this morning and it looks like I’ve got it all working. I still have to do a little work adding the new sub categories in the layout builder, but I can live with this.

Best wishes,
Ken

Hi Ken,

Glad to know that everything is working now.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.