Creating a layout for a Category Ancestor

I’m trying to create some layouts for post category archives, but trying to avoid having to assign the layouts to every subcategory.

Our category setup is like this:

  • International
    • Country A
    • Country B

I’ve got a nice archive layout page for my International category, but I’d also like to use it for all the subcategories. I can achieve something like this when I’m creating page layouts by using the Page Ancestor condition, but can’t do this for categories:

![Screenshot 2021-05-26 at 13.41.28|690x345](upload://zU

0kxF27AIXV8E52aPHd6wUL1mH.png)

I know this might end up being a bit of a feature request, but is there any other way to achieve this?

Thanks,
Anthony

1 Like

Hello @abitgone,

Thanks for writing in! Is your post-category archive layout the same for all categories? You can simply assign the layout to display in all categories instead. If ever, you have two different layouts, you can assign the layouts to the respective category. Keep in mind that for archive layouts, you do not need to have a Looper Provider. This is because the WordPress archive page itself runs a loop and thus, any archive layout can be used on categories and subcategories.

If nothing is helping, provide us access to your site so that we can check your settings. Please create a secure note 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

Best Regards.

Hi @ruenel,

Not quite - we have a standard archive layout planned for all archives, but are looking to create two category archive layouts for each root category - one for the root category, and one that will be used by all the sub-categories.

If you were to look at the International category archive, for example, we want it to show the sub-categories on that page, and nothing much else. (I wouldn’t mind if it had posts from all categories, but I’d prefer it not to.)

Then, if you were to look at one of the sub-categories within International – let’s say International Expedition A – this would then simply show all the posts for that category.

The sub categories themselves won’t be fixed, and are likely to change often – by people who probably shouldn’t have access to the Pro editors – so we want this to be a case of us doing the work once and then handing it over.

If that’s not clear, let me know and I’ll be happy to run you through a demo of what we’re trying to achieve.

Thanks.

Hello @abitgone,

Sub Categories are also listed as the Category in the Condition and you need to select all sub-categories for which you want to assign a specific layout.

I have created a Parrent category and Child Category.

Please have a look at the given screenshot of the layout condition of Parent Category

Subcategory layout

Hope it helps
Thanks

Thanks @prakash_s,

The problem is that the sub categories will change quite often, and we don’t want to have to keep going into the layout and adding additional sub categories.

Would it be possible for me to put this in as a feature request - being able to assign an archive to a “root category” or “category ancestor”?

Thanks,
Anthony

Hi Anthony,

Unfortunately, there is no other option currently. I will check and surely add this to feature request so it might be taken into account in the future.

Thanks

1 Like

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