• Hey guys,
    I’m making WP theme in which Max Mega Menu will be option for main navigation.
    The problem is, I can’t overwrite default MMM theme with my exported one.
    I followed all the developers instructions from here but nothing.

    This is my exported theme:

    if ( function_exists('max_mega_menu_is_enabled') ) {
    
    	function megamenu_add_theme_millennio_mega_menu_1525082014($themes) {
    		$themes["millennio_mega_menu_1525082014"] = array(
    			'title' => 'Millennio Mega Menu',
    			'container_background_from' => 'rgba(0, 0, 0, 0)',
    			'container_background_to' => 'rgba(0, 0, 0, 0)',
    			'arrow_up' => 'dash-f343',
    			'arrow_down' => 'dash-f347',
    			'arrow_left' => 'dash-f341',
    			'arrow_right' => 'dash-f345',
    			'menu_item_background_hover_from' => 'rgba(0, 0, 0, 0)',
    			'menu_item_background_hover_to' => 'rgba(0, 0, 0, 0)',
    			'menu_item_link_font_size' => '12px',
    			'menu_item_link_height' => '46px',
    			'menu_item_link_color' => 'rgb(0, 0, 0)',
    			'menu_item_link_text_transform' => 'uppercase',
    			'menu_item_link_color_hover' => 'rgb(101, 101, 101)',
    			'menu_item_link_padding_left' => '0',
    			'menu_item_link_padding_right' => '22px',
    			'panel_background_from' => 'rgb(255, 255, 255)',
    			'panel_background_to' => 'rgb(255, 255, 255)',
    			'panel_width' => 'body',
    			'panel_inner_width' => '.container',
    			'panel_header_color' => 'rgb(0, 0, 0)',
    			'panel_header_border_color' => 'rgb(0, 0, 0)',
    			'panel_padding_top' => '30px',
    			'panel_padding_bottom' => '20px',
    			'panel_widget_padding_left' => '0px',
    			'panel_widget_padding_right' => '0px',
    			'panel_font_size' => '12px',
    			'panel_font_color' => 'rgb(0, 0, 0)',
    			'panel_font_family' => 'inherit',
    			'panel_second_level_font_color' => 'rgb(0, 0, 0)',
    			'panel_second_level_font_color_hover' => 'rgb(101, 101, 101)',
    			'panel_second_level_text_transform' => 'uppercase',
    			'panel_second_level_font' => 'inherit',
    			'panel_second_level_font_size' => '12px',
    			'panel_second_level_font_weight' => 'bold',
    			'panel_second_level_font_weight_hover' => 'bold',
    			'panel_second_level_text_decoration' => 'none',
    			'panel_second_level_text_decoration_hover' => 'none',
    			'panel_second_level_border_color' => 'rgb(0, 0, 0)',
    			'panel_third_level_font_color' => 'rgb(0, 0, 0)',
    			'panel_third_level_font_color_hover' => 'rgb(101, 101, 101)',
    			'panel_third_level_font' => 'inherit',
    			'panel_third_level_font_size' => '12px',
    			'panel_third_level_padding_top' => '3px',
    			'panel_third_level_padding_bottom' => '3px',
    			'flyout_width' => '210px',
    			'flyout_menu_background_from' => 'rgb(255, 255, 255)',
    			'flyout_menu_background_to' => 'rgb(255, 255, 255)',
    			'flyout_padding_top' => '14px',
    			'flyout_padding_bottom' => '14px',
    			'flyout_link_padding_left' => '32px',
    			'flyout_link_padding_right' => '32px',
    			'flyout_link_height' => '30px',
    			'flyout_background_from' => 'rgba(0, 0, 0, 0)',
    			'flyout_background_to' => 'rgba(0, 0, 0, 0)',
    			'flyout_background_hover_from' => 'rgba(0, 0, 0, 0)',
    			'flyout_background_hover_to' => 'rgba(0, 0, 0, 0)',
    			'flyout_link_size' => '12px',
    			'flyout_link_color' => 'rgb(0, 0, 0)',
    			'flyout_link_color_hover' => 'rgb(101, 101, 101)',
    			'flyout_link_family' => 'inherit',
    			'flyout_link_text_transform' => 'uppercase',
    			'responsive_breakpoint' => '1024px',
    			'line_height' => '1.625',
    			'transitions' => 'on',
    			'toggle_background_from' => 'rgba(0, 0, 0, 0)',
    			'toggle_background_to' => 'rgba(0, 0, 0, 0)',
    			'toggle_font_color' => 'rgb(0, 0, 0)',
    			'mobile_background_from' => 'rgb(255, 255, 255)',
    			'mobile_background_to' => 'rgb(255, 255, 255)',
    			'mobile_menu_item_link_font_size' => '18px',
    			'mobile_menu_item_link_color' => 'rgb(0, 0, 0)',
    			'mobile_menu_item_link_text_align' => 'left',
    			'custom_css' => '/** Push menu onto new line **/
    	#{$wrap} {
    		clear: both;
    	}',
    		);
    		return $themes;
    	}
    	add_filter('megamenu_themes', 'megamenu_add_theme_millennio_mega_menu_1525082014');
    

    But the problem lays in this overwriting function:

    function millennio_megamenu_override_default_theme($value) {
    		// change 'primary' to your menu location ID
    		if ( !isset($value['menu_1']['theme']) ) {
    			$value['menu_1']['theme'] = 'millennio_mega_menu_1525082014'; // change my_custom_theme_key to the ID of your exported theme
    		}
    
    		return $value;
    	}
    	add_filter('default_option_megamenu_settings', 'millennio_megamenu_override_default_theme');

    https://www.megamenu.com/documentation/theme-developers/#changing-the-default-theme

    Filter default_option_megamenu_settings doesn’t exist in your plugin.

    The thing I need is, when user installs Max Mega Menu, my custom MMM theme is selected by default for menu_1 location, which is the only location in this theme.

    Any help will be very much appreciated.

    Thanks in advance,

    Djordje

    • This topic was modified 5 years, 11 months ago by djordjekrstic.
Viewing 1 replies (of 1 total)
  • Plugin Author megamenu

    (@megamenu)

    Hi Djordje,

    Thanks for getting in touch.

    “default_option_X” is a core filter, so you won’t find a reference to it in the code (it took me a while to realise/remember this too).

    https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_option_(option_name)

    It looks like you have the ‘add_filter’ line in the incorrect place? It should be on it’s own line. Let me know how that goes, and remember to delete the data so you are working from a ‘clean’ install.

    You can also “tidy up” that theme ID (millennio_mega_menu_1525082014) if you want – the random numbers are added to prevent collisions, but I suspect just “millennio_mega_menu” is unique enough.

    Regards,
    Tom

Viewing 1 replies (of 1 total)
  • The topic ‘Overwriting default mega menu theme’ is closed to new replies.