PHP code example of viget / mega-menu-block

1. Go to this page and download the library: Download viget/mega-menu-block library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

viget / mega-menu-block example snippets


// Span the whole header rather than just the Navigation block.
add_filter( 'mega_menu_block_positioning_context', fn() => '.site-header' );

// Match the theme's own navigation breakpoint.
add_filter( 'mega_menu_block_breakpoint', fn() => '880px' );

// Start every new Mega Menu on the same background.
add_filter(
	'mega_menu_block_default_attributes',
	function( $attributes ) {
		$attributes['backgroundColor'] = 'primary';
		return $attributes;
	}
);