WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.47k stars 4.18k forks source link

Site Editor: Select multiple categories for custom archive template #57326

Open ffabbr opened 10 months ago

ffabbr commented 10 months ago

What is it?

In the WP site editor (FSE), when adding a template using the site editor, one option is "category-archive". The user can set one category where the created template will be used. However, there should be an option to add multiple categories to use that archive template on. Or even going further and implement a simple query filter UI.

What problem does this address?

Complex websites simply can't use the custom archive feature at this stage, because (this was for a project of mine) they would have to duplicate the same archive template over 30 times, which results in a cluttered environment. Having a more powerful selector to select multiple archives to use the template on solves the issue.

What is your proposed solution?

To start with, one should be able to select multiple categories by displaying a checkmark next to the title and a blue "Next" button at the bottom of the popup. Even better would be a filter-like system similar to the one in the elementor theme builder. Being able to select multiple categories, set it for all child categories of a category, and even exclude certain categories from the query.

What are the next steps?

Let's start working on a design for both the multiple selections and the "Category Selector Query" system. I appended screenshots from the elementor theme builder. Any help is appreciated!

Current popup

Current Category Archive System

Elementor

elementor1 elementor2
graylaurenm commented 10 months ago

This seems a little overkill for Core. A workaround on your end would be to use a custom taxonomy. Then all of those archive pages would have one template while categories would have another. This would avoid a lot of complex logic by taking a more foundational approach.

ffabbr commented 10 months ago

Hey Lauren, I understand that a fully-fledged query might be a little overkill; though a simple multiple-select feature seems both intuitive and useful. I've created a mockup of the multiple-selector in the popup.

A workaround on your end would be to use a custom taxonomy. Then all of those archive pages would have one template while categories would have another. This would avoid a lot of complex logic by taking a more foundational approach.

Thanks a lot for the workaround, it worked indeed! :)

292327874-0ea1f998-6fa9-4263-9211-9684e3819794