Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.43k stars 1.99k forks source link

Add 'categories block' to a menu item in the 'navigation block'. #65012

Open janmckell opened 2 years ago

janmckell commented 2 years ago

What

It would be useful and quite convenient if one is able to add a 'categories block'as a sub-menu item in the 'navigation block'.

The closest I could come to this functionality, was by creating a categories list next to the 'parent menu' item and set the categories list as dropdown, but this is less than ideal.

Even then, aligning this in the layout was tricky.

Markup on 2022-06-27 at 16:51:35

Why

If anyone wants to use the Site Editor to create a category-driven menu, there are no options for this, unless they use a classic or universal theme, where they can create the menu using either the Menu settings in the dashboard or the menu settings in the Customizer.

How

No response

vajrasar commented 2 years ago

This is a good idea. Thanks for sharing. @janmckell

It'd also be great to see how you managed to do the workaround (creating a categories list next to the 'parent menu' item). Maybe you can share a screen record of the workaround.

janmckell commented 2 years ago

Thanks! @vajrasar

This is a very basic hack, because it isn't a traditional sub-menu, and the options for layout and styling are limited.

Here is a screenshot of what I've done:

Markup 2022-07-14 at 05 59 55

Gustavo-Hilario commented 1 year ago

+1 for this implementation. The navigation block won't pull category pages if several pages or posts match the search terms being used:

Search term used in one post Search term used on several pages or posts

Maybe this could be done by prioritizing the category page with the exact search term. From the second screenshot, it looks like even pages that only have the search term on their content (not in the title) have a higher priority on the search results than the specific category page.

jp-imagines commented 1 year ago

Came across another customer request for this in 5861905-zd-woothemes. Specifically, this user made changes to their post categories (adding extra sub-categories and rearranging the overall hierarchy) and expected their menu links to update automatically.

It would be great to be able to insert something like the "Categories List" block into a Navigation block. It's not particularly uncommon for folks to want to include links to all of their post categories in their menu for easy browsing, and for sites with many categories, that can be a lot of manual work.

As it stands, the Categories List block is either an actual list (which doesn't mesh well with a Nav menu), or a classic dropdown (which has the right general functionality but very mismatched design next to a Nav block).

This is further complicated by what @Gustavo-Hilario mentioned above: it can be hard to find the link to a post category on some sites. This was the case for my customer as well – some categories simply refused to show up in searches unless you had managed to insert a "Category Link" block into the Nav block, which I found no way to do manually other than to duplicate an existing Category Link block.

github-actions[bot] commented 1 year ago

Support References

This comment is automatically generated. Please do not edit it.

khristiansnyder commented 1 year ago
cuemarie commented 1 year ago

Thinking this may be a core feature, so I dug around a little and found a couple issues in core that I wanted to connect dots with:

Right now, the best way I can think of to add category pages to the Nav block is by directly pasting the Links, which is definitely cumbersome, as others put it :) Which brings up another related request, where adding post categories has recently been mentioned as well:

sharonlaker19 commented 1 year ago

It's now possible to add categories to the menu in the sidebar, the steps are documented here. The categories option still doesn't work on the main page for .com sites though. Discussed in more detail here: pc4f5j-2SA-p2#comment-3455.

getdave commented 3 weeks ago

I'm trying to get a sense of how important this is to folks. I'm imagining that there may be scenarios where folks want to create a submenu from a list of terms in taxonomy (i.e. a list of "Categories" on a Blog).

We have a Categories list block but it isn't supported by the Nav block by default.

We could allow this but we'd need to put the same affordances in place as we have for the Page List block to ensure it inherits styling...etc.