• dramb

    (@dramb)


    Does your block allow use of a custom nav-walker class? I have a theme based on w3.css with a nav-walker class to create w3.css based menus, and I am creating a w3.css block theme based on that theme. But I want the w3.css nav menu in it. But there is no doc on how to use nav-walker classes with the new block menu nav. So I’m hoping I can customise your block or that your block provides customisation.

Viewing 1 replies (of 1 total)
  • You would have to override the block render callback with register_block_type and implement your own version of render_block_classic_menu(). From there you can extend Walker_Nav_Menu with your own class and pass it into wp_nav_menu in your render callback.

    Should all be doable from your theme though.

    I got frustrated with the limited block navigation and have been implementing my own version of a classic menu block plugin with a custom walker and mobile menu support. You could probably accomplish most of what you’re looking for with the method I outlined above – I just went for a custom plugin so I could add support for render templates with custom walkers in the theme and a separate menu toggle block.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.