Support » Plugin: Max Mega Menu » Unable to Replace WP Main Menu with Mega Menu

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author megamenu

    (@megamenu)

    Hi,

    It looks like you have fixed this now?

    We don’t want to tamper with the theme’s header.php file/coding, as it will be overwritten when the theme is updated.

    You can avoid this issue by creating a child theme and copying the header.php file to it.

    Regards,
    Tom

    Thread Starter Divan

    (@divan-web-devine)

    Thank you, Tom.

    I appreciate your feedback and guidance.

    We copied the header.php file to the child theme folder > included the php code in the file > this solved the issue.

    All the best!

    Thread Starter Divan

    (@divan-web-devine)

    Hi Tom,

    Last query; kindly see the revised header.php code below – it’s not showing as it should on the demo page (not sure whether the code was pasted in the wrong spot/line?)

    <?php
    	if ( ! defined('ABSPATH') ){ die(); }
    	
    	global $avia_config;
    	
    	$lightbox_option = avia_get_option( 'lightbox_active' );
    	$avia_config['use_standard_lightbox'] = empty( $lightbox_option ) || ( 'lightbox_active' == $lightbox_option ) ? 'lightbox_active' : 'disabled';
    
    	/**
    	 * Allow to overwrite the option setting for using the standard lightbox
    	 * Make sure to return 'disabled' to deactivate the standard lightbox - all checks are done against this string
    	 * 
    	 * @added_by Günter
    	 * @since 4.2.6
    	 * @param string $use_standard_lightbox				'lightbox_active' | 'disabled'
    	 * @return string									'lightbox_active' | 'disabled'
    	 */
    	$avia_config['use_standard_lightbox'] = apply_filters( 'avf_use_standard_lightbox', $avia_config['use_standard_lightbox'] );
    
    	$style 					= $avia_config['box_class'];
    	$responsive				= avia_get_option( 'responsive_active' ) != 'disabled' ? 'responsive' : 'fixed_layout';
    	$blank 					= isset( $avia_config['template'] ) ? $avia_config['template'] : '';	
    	$av_lightbox			= $avia_config['use_standard_lightbox'] != 'disabled' ? 'av-default-lightbox' : 'av-custom-lightbox';
    	$preloader				= avia_get_option( 'preloader' ) == 'preloader' ? 'av-preloader-active av-preloader-enabled' : 'av-preloader-disabled';
    	$sidebar_styling 		= avia_get_option( 'sidebar_styling' );
    	$filterable_classes 	= avia_header_class_filter( avia_header_class_string() );
    	$av_classes_manually	= 'av-no-preview'; /*required for live previews*/
    	
    	/**
    	 * If title attribute is missing for an image default lightbox displays the alt attribute
    	 * 
    	 * @since 4.7.6.2
    	 * @param bool
    	 * @return false|mixed			anything except false will activate this feature
    	 */
    	$mfp_alt_text = false !== apply_filters( 'avf_lightbox_show_alt_text', false ) ? 'avia-mfp-show-alt-text' : '';
    
    	/**
    	 * Allows to alter default settings Enfold-> Main Menu -> General -> Menu Items for Desktop
    	 * @since 4.4.2
    	 */
    	$is_burger_menu = apply_filters( 'avf_burger_menu_active', avia_is_burger_menu(), 'header' );
    	$av_classes_manually   .= $is_burger_menu ? ' html_burger_menu_active' : ' html_text_menu_active';
    
    	/**
    	 * Add additional custom body classes
    	 * e.g. to disable default image hover effect add av-disable-avia-hover-effect
    	 * 
    	 * @since 4.4.2
    	 */
    	$custom_body_classes = apply_filters( 'avf_custom_body_classes', '' );
    
    	/**
    	 * @since 4.2.3 we support columns in rtl order (before they were ltr only). To be backward comp. with old sites use this filter.
    	 */
    	$rtl_support = 'yes' == apply_filters( 'avf_rtl_column_support', 'yes' ) ? ' rtl_columns ' : '';
    	
    	
    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?> class="<?php echo "html_{$style} {$responsive} {$preloader} {$av_lightbox} {$filterable_classes} {$av_classes_manually}" ?> ">
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <?php
    
    /*
     * outputs a rel=follow or nofollow tag to circumvent google duplicate content for archives
     * located in framework/php/function-set-avia-frontend.php
     */
     if( function_exists( 'avia_set_follow' ) ) 
     { 
    	 echo avia_set_follow();
     }
    
    ?>
    
    <!-- mobile setting -->
    <?php
    
    $meta_viewport = ( strpos( $responsive, 'responsive' ) !== false ) ?  '<meta name="viewport" content="width=device-width, initial-scale=1">' : '';
    
    /**
     * @since 4.7.6.4
     * @param string
     * @return string
     */
    echo apply_filters( 'avf_header_meta_viewport', $meta_viewport );
    
    ?>
    
    <!-- Scripts/CSS and wp_head hook -->
    <?php
    /* Always have wp_head() just before the closing </head>
     * tag of your theme, or you will break many plugins, which
     * generally use this hook to add elements to <head> such
     * as styles, scripts, and meta tags.
     */
    
    wp_head();
    
    ?>
    
    </head>
    
    <body id="top" <?php body_class( $custom_body_classes . ' ' . $mfp_alt_text .' ' . $rtl_support . $style . ' ' . $avia_config['font_stack'] . ' ' . $blank . ' ' . $sidebar_styling); avia_markup_helper( array( 'context' => 'body' ) ); ?>>
    
    	<?php 
    	
    	/**
    	 * WP 5.2 add a new function - stay backwards compatible with older WP versions and support plugins that use this hook
    	 * https://make.wordpress.org/themes/2019/03/29/addition-of-new-wp_body_open-hook/
    	 * 
    	 * @since 4.5.6
    	 */
    	if( function_exists( 'wp_body_open' ) )
    	{
    		wp_body_open();
    	}
    	else
    	{
    		do_action( 'wp_body_open' );
    	}
    	
    	do_action( 'ava_after_body_opening_tag' );
    		
    	if( 'av-preloader-active av-preloader-enabled' === $preloader )
    	{
    		echo avia_preload_screen(); 
    	}
    		
    	?>
    
    	<div id='wrap_all'>
    
    	<?php 
    	if( ! $blank ) //blank templates dont display header nor footer
    	{ 
    		//fetch the template file that holds the main menu, located in includes/helper-menu-main.php
    		get_template_part( 'includes/helper', 'main-menu' );
    
    	} ?>
    		
    	<div id='main' class='all_colors' data-scroll-offset='<?php echo avia_header_setting( 'header_scroll_offset' ); ?>'>
    
    	<?php 
    		
    		if( isset( $avia_config['temp_logo_container'] ) ) 
    		{
    			echo $avia_config['temp_logo_container'];
    		}
    		
    		do_action( 'ava_after_main_container' ); 
    
    wp_nav_menu( array( 'theme_location' => 'max_mega_menu_1' ) );
    Plugin Author megamenu

    (@megamenu)

    Hi Divan,

    It looks correct to me, but I am not familiar with the theme. Instead of trying to output the menu, you could try outputting some test text (e.g. “menu goes here”). Once you have that working, replace it with the PHP code. Make sure your child theme is activated too.

    Regards,
    Tom

    Thread Starter Divan

    (@divan-web-devine)

    Hi Tom,

    Thank you for your feedback.

    We will run some further tests, but the developer still cannot get the mega menu to replace the main menu on the demo page for some reason.

    It’s the Enfold theme.

    Plugin Author megamenu

    (@megamenu)

    Hi Divan,

    I am not sure what has changed, because it was working previously.

    I think you will need to ask your developer to manually integrate the menu:

    https://www.megamenu.com/documentation/manual-php/

    Regards,
    Tom

    Thread Starter Divan

    (@divan-web-devine)

    Thank you, Tom.

    We will look into it.

    Thread Starter Divan

    (@divan-web-devine)

    Hi Tom,

    The developer managed to get the menu implemented on the supplied demo page/URL.

    One final question; how can the color of the menu items be changed to black on the sticky header (after a user scrolls down on the page)?

    We have tried numerous solutions, with no luck.

    Thank you once again for your assistance, it’s much appreciated.

    Plugin Author megamenu

    (@megamenu)

    Hi Divan,

    Please ask your developer to look at the bottom section of this page:

    https://www.megamenu.com/documentation/sticky-menu-background-color/

    Regards,
    Tom

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