Beplus Visual Mega Navigation
Build mega menu panels visually with the WordPress block editor: per-item settings, starter templates, and accessible front-end output.
Install in
Beplus Visual Mega Navigation adds a Gutenberg-powered mega menu builder to Appearance Menus. A top-level (depth-0) menu item can get a visual panel designed with the block editor instead of a plain sub-menu, and the panel is rendered on the front end by a menu walker that keeps keyboard and screen-reader behaviour intact.
Features
- Visual builder — design panel content with the block editor: columns, headings, images, buttons, lists, and the plugin’s navigation blocks.
- Per-item settings — enable or disable the panel, panel width, custom width, panel position, and open animation for each top-level menu item.
- Starter templates — apply a ready-made layout from the template store, import a JSON file, or export the current design.
- Block patterns — the BePlus Header Inline — Logo / Menu / Toggle pattern is available in the Site Editor for block themes.
- Root-level only — only top-level menu items can host a mega panel.
- Accessible front end — the front-end script manages
aria-haspopup,aria-expanded, andaria-controls; Escape closes an open panel and moving focus out of the panel closes it. - Theme friendly — panel markup uses
beplus-vmn-*classes and--beplus-vmn-mega-*CSS custom properties, and the width mode is exposed ashas-mega-menu--{width}on the menu item. - Nothing extra in the database — settings and content are stored in
nav_menu_itempost meta, and the legacy_jemented_megamenu_*keys are still read on migrated sites.
Requirements
- WordPress 6.0 or higher.
- PHP 8.0 or higher.
- WooCommerce — optional, required by the Product List and Product Card blocks.
- Node.js — development builds only; the required version is pinned in
.nvmrc(currently 24).
Getting started
- Go to Appearance Menus and open (or create) a menu.
- Click Mega Menu on a top-level menu item. The Mega Menu Builder opens for that item only.
- On the Settings tab, turn on Enable Mega Menu and choose the panel width, position, and open animation.
- Switch to the Content Builder tab and build the panel with the block editor.
- Use Import or Export in the modal header to apply a starter template or download the current design as JSON.
- Click Save.
Mega menu templates
Templates are JSON files discovered from these locations. When the same slug exists in more than one place, the last location wins.
- Plugin —
beplus-visual-mega-nav/templates/*.json(lowest priority). - Parent theme —
{theme}/mega-menu-templates/*.json. - Child theme —
{child-theme}/mega-menu-templates/*.json(highest priority).
Built-in templates:
featured-with-links— Featured + Links.mega-4-columns— 4 Columns.blog-and-quote-2-cols— Quotes + blog list.hero-artwork-3-cols— Hero Artwork 3 cols.
A theme file with the same slug as a plugin template replaces the plugin version in the Import dropdown. Exported files use the same format, so you can drop an export into mega-menu-templates/ and add a slug to publish it in the store.
Template file format
Each template is a single JSON object:
{
"slug": "my-custom-menu",
"title": "My Custom Menu",
"description": "Optional short description shown in the Import dropdown.",
"version": "1.0.0",
"settings": {
"width": "full",
"customWidth": 1200,
"position": "item-left",
"bgColor": "",
"animation": "fade"
},
"content": "Serialized block markup"
}
Fields:
slug— used as the filename ({slug}.json); falls back to the filename without.json.title— label shown in the Import dropdown.description— optional text shown under the title.version— template metadata only.settings— optional panel settings applied with the template.content— required, serialized block markup in the same format that is saved to the menu item.
Panel settings keys:
width—fullorcustom.customWidth— panel width in pixels whenwidthiscustom(200–2400, default 780).position—item-left,item-center, orscreen-center(used with a custom width).bgColor— panel background color as a hex value.animation—fade,slide, ornone.
Template content is sanitized on load with the same rules as saved mega menu content, so only blocks from the allowed list below are kept.
Included blocks
Core blocks available in the Content Builder: Columns, Column, Group, Row, Stack, Heading, Paragraph, List, List item, Image, Buttons, Button, Separator, Spacer, Cover, Page List, Shortcode, and Custom HTML.
Blocks added by this plugin:
- Menu List and Menu Item — navigation lists with current-page detection, active state styling, and badges.
- Link Item — single navigation link with an optional description and badge.
- Tab Container and Tab Panel — tabbed mega menu content, vertical sidebar or horizontal top bar.
- BePlus Header and BePlus Navigation — header container with sticky and scroll effects, plus a classic menu with hamburger toggle.
- Menu Area — renders a classic WordPress menu inside the panel using the mega menu engine.
- Nav Toggle — hamburger button that opens the mobile navigation overlay.
- Hero Artwork Dock, Blog List, Quote, Product List, and Product Card — content blocks for promotional panels.
Third-party blocks appear in the Content Builder once they are registered, and you can allow them with the beplus_vmn_allowed_blocks filter.
Front-end behaviour
The front-end script (assets/js/frontend.js) picks the panel behaviour from the viewport:
- ≥1024px — hover / focus flyout; a panel whose item link has no real URL also opens on click.
- 768–1023px — the panel becomes a fixed off-canvas drawer with a backdrop overlay, and page scroll is locked while it is open.
- ≤767px — the panel expands inline as an accordion inside its menu item.
Those bands are the default for every theme and are not configurable.
Hosting panels in your own compact drawer
A theme that already renders its own compact navigation below 1024px can ask for the panels to stay inline inside it by putting the compact-mode attribute on the navigation element that wraps its menu:
<nav id="site-navigation" data-beplus-vmn-compact-mode="accordion">
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav>
Below 1024px the panels inside that navigation then expand inline — position: static, full width, closed until .is-open or .beplus-vmn--open — and never become an off-canvas drawer, never add the .beplus-vmn-overlay backdrop and never write document.body.style.overflow. The host therefore keeps sole ownership of page scroll and of its own drawer breakpoint. The attribute is read per navigation from the mega menu item upwards, so any other navigation on the page keeps the default bands, and there is no setting or breakpoint option for it.
The desktop flyout is defined by CSS alone: hover on a fine pointer and :focus-within reveal a server-rendered panel even when the script never runs. Click toggling, ARIA state, custom-width positioning and entrance animations are what the script adds on top.
REST API
The admin screen uses these routes. All of them require the edit_theme_options capability.
GET /wp-json/beplus-visual-mega-nav/v1/item/{id}— readenabled,settings, andcontentfor a menu item.POST /wp-json/beplus-visual-mega-nav/v1/item/{id}— saveenabled,settings, andcontent.GET /wp-json/beplus-visual-mega-nav/v1/templates— list template summaries (slug, title, description, source).GET /wp-json/beplus-visual-mega-nav/v1/templates/{slug}— load one template, includingsettingsandcontent.
Developer hooks
Filters provided by the plugin:
beplus_vmn_locations— theme locations that use the mega menu walker (defaultprimary,main-menu,header).beplus_vmn_apply_walker— force the walker on or off for a givenwp_nav_menu()call; returntrueorfalse.beplus_vmn_allowed_blocks— block names allowed in the Content Builder.beplus_vmn_template_directories— template scan directories, keyed by source label.beplus_vmn_templates— template list returned to the admin UI, keyed by slug.beplus_vmn_template_data— a single template before it is returned by the REST API.beplus_vmn_template_part_content— markup of a bundled block pattern before it is registered.beplus_vmn_link_item_attributes— Link Item block attributes before rendering.beplus_vmn_link_item_render_markup— rendered Link Item HTML.beplus_vmn_link_item_badge_variants— allowed badge variant slugs.beplus_vmn_indicator_mode— which element draws the caret of a top-level item with a panel or sub-menu:'link'(default, the link caret, same look as 0.0.26) or'toggle'(the disclosure button icon; the link::afteris then suppressed). Arguments: mode, menu item, menu args, depth. The toggle button works the same in both modes; inlinkmode only its icon is hidden.
Example: adding a custom block to the Content Builder.
add_filter( 'beplus_vmn_allowed_blocks', function ( array $blocks ): array {
$blocks[] = 'my-plugin/featured-card';
return $blocks;
} );
Example: adding a template directory.
add_filter( 'beplus_vmn_template_directories', function ( array $directories ): array {
$directories['my-plugin'] = plugin_dir_path( __FILE__ ) . 'mega-menu-templates';
return $directories;
} );
Data storage
Each menu item stores three meta values on the nav_menu_item post:
_beplus_vmn_enabled— whether the item renders a mega panel. A panel also needs non-empty_beplus_vmn_content: an enabled item with empty content keeps its ordinary sub-menu instead of rendering an empty panel._beplus_vmn_settings— JSON string with the panel settings listed above._beplus_vmn_content— serialized block markup.
Development
npm run start— watch admin assets.npm run build— production build intobuild/.composer check— PHP lint, PHPCS, PHPStan.npm run check:js— ESLint and Stylelint.
Written by Joobi from the project's own listing. See the source page
0.0.27
- Header and navigation blocks now keep SVG,
picture/source, and ARIA attributes when printed, whilescripttags andjavascript:URLs are still stripped. - Improved keyboard access and ARIA for top-level mega menus and dropdowns.
- Mega panels now open inside the header drawer on tablets from 768px to 1023px.
- Drawer toggles and the Close button now have 44px tap targets and
touch-action: manipulation.
0.0.25
- New Menu List and Menu Item blocks with current-page detection, active states, and badges.
- New panel settings: default and custom panel width, plus panel position (aligned with the menu item, centered on the menu item, or centered on the screen).
- Panel markup now exposes
data-width,data-custom-width,data-position, and width modifier classes for theme styling. - Fixed mega menu panels not loading correctly on some menus.
0.0.13
- New starter templates: Quotes + blog list and Hero Artwork 3 cols.
- Added GitHub contribution and release automation.
0.0.12
- New Product List and Product Card blocks for WooCommerce, using GSAP for the stacked deck animation.
- Updated the Quote block.
0.0.11
- New Hero Artwork Dock and Blog List blocks; reworked BePlus Navigation and BePlus Header.
- Fixed the ordering of the Hero Artwork block.
- Resolved JavaScript, CSS, and PHP lint errors in the Quote block.
0.0.10
- Fixed some PHP issues.
- Improved the backend editor.
- Fixed the theme header hover mega menu and menu walker handling when a
WP_Termobject is passed.
0.0.9
- New Block tab in the mega menu modal for improved block management.
0.0.7
- Fixed WordPress.org review feedback and classic menu rendering in the Menu Area block.
0.0.6
- New BePlus Header block and the BePlus Header Inline pattern.
- WordPress.org plugin check fixes and code quality tooling.
0.0.5
- Initial release.
Follow this listing's changes (Atom feed)