• My company is working on a custom block theme for one of our sites, and we’re currently trying to add a custom search block within the core navigation block that will display in the menu. Currently within the navigation options when you go to add a new item such as a page link, there is a “Transform” section that provides 4 blocks that can be added; search, social icons, page list, and site logo.

    How would I go about adding a custom block we created to that menu so that it can be inserted in the same manner within the navigation? It’s a simple block and it works well elsewhere when added to pages, but I cannot find any documentation on how to make the navigation block aware of its existence and allow for us to insert it into a site menu.

    • This topic was modified 1 year, 6 months ago by nicnickj.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello!

    It’s a simple block and it works well elsewhere when added to pages,?…

    Would you mind explaining what you mean with “elsewhere”?

    I assume you are using a block based theme at the moment.

    I tried to add a mini-cart block to the navigation, here are the steps:

    • Go to Appearance
    • Click on Editor
    • Click on Patterns
    • Go to Template Parts
    • Click on the Header you are working on, as there might be more than one Header
    • Click again, and you will be taken to the site editor, where you can add the block to the navigation.

    Hope it helps!

    Thread Starter nicnickj

    (@nicnickj)

    Thank you for your response, Devin.

    The theme is in fact a block theme, and the block in question is a custom block developed for the theme to control specific functionality within the site.

    By “elsewhere” I mean that the custom block is accessible and able to be added anywhere else within the WordPress block editor other than the one place I need to add it, which is the Navigation block. I can add it from the editor menu and insert it into a page, a pattern, a template part, etc. But I’m looking to add it specifically to the Navigation block as you can do with blocks such as Search, Site Logo, Page List, and Social Icons.

    If you go to Appearance > Editor > Navigation and select one of your site’s saved navigation menus, when adding a new menu item with the “+” icon, the 4 blocks listed above are available to add under the “Transform” heading in the menu that appears. That’s where I’m looking to make the custom block available so that it can be added in the manner.

    Currently I can add the block markup manually within the Code Editor of the Navigation block, but that is not ideal for all users. I’m hoping there is a way to hook into that functionality and display my custom block as an option. I’m thinking it will have to be on the theme-level as the block.json settings do not appear to have an option for it to display within this menu. It’s currently set to a “widget” for the category, and even if I try to make its parent block the “core/navigation” block, it doesn’t appear as an option to be added within.

    Every resource I’ve found just takes me around in circles and does not address how to do this.

    • This reply was modified 1 year, 6 months ago by nicnickj.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Extending the Navigation Block Transform Options’ is closed to new replies.