BuddyBoss Home – Web Support Forums Solutions Social Learner How to remove the header-menu

Viewing 4 posts - 1 through 4 (of 4 total)
  • Question

    #69081
    @hichem

    HI,

    I'm trying to remove the header-menu aka the Titlebar menu so I can replace it with a custom menu that can allow me to use a mega menu.

    I have tried the following code the wordpress code in functions.php of the boss child theme, but it's not working, the menu is still there:

    function remove_parent_theme_features() {
        unregister_nav_menu( 'header-menu');
    }
    add_action( 'after_setup_theme', 'remove_parent_theme_features' );
    

    I'll appreciate if someone can explain to me how to disable the header menu and replace with a custom one.

    Best regards,

    Answers

    #69133

    Deepak BuddyBoss
    Participant
    @deepak

    Hey Hichem!

    you could override header menu in child theme; Just put the header-middle-column.php template in your boss child theme folder like this: youBossChildThemeName/template-parts/header-middle-column.php

    Disable the header menu and replace with a custom one this way 😉

    #69141
    @hichem

    Hi Paresh,

    Thanks I'll try that and if it works I'll post the code, for those who want to do the same thing.

    #69214
    @hichem

    ok just to give an update I have installed the ubermenu plugin and after numerous try and fails, I finally managed to understand what need to be changed to have it working.

    wish the theme had some kind of developers documentation to understand the code, anyway now I have a mega menu (I ned to modify the CSS to match the look & feel)

    here is the code for those who are interested:

    add this code to functions.php of the child theme

    function buddyboss_custom_menu() {
    
      // Adds two new navigation menu for the mobile display
      // as it breaks when you activate the mega menu.
      register_nav_menus( array(
        'left-panel-non-logged'  => __( 'Left Panel Non Logged', 'boss' ),
        'left-panel-logged'    => __( 'Left Panel Logged', 'boss' ),
      ) );
    
    }
    
    add_action( 'after_setup_theme', 'buddyboss_custom_menu' );

    add this modification to Boss-Child/template-parts/header-middle-column.php

    <?php if( function_exists( 'ubermenu' ) ): ?>
       	<?php ubermenu( 'main' , array( 'theme_location' => 'header-menu' ) ); ?>
    <?php else: ?>
            <div class="header-navigation">
    	   <div id="header-menu">
    		<ul>
    		    <?php echo $buddypanel_menu . $titlebar_menu; ?>
    		</ul>
    	   </div>
    	   <a href="#" class="responsive_btn"><i class="fa fa-align-justify"></i></a>
            </div>
    <?php endif; ?>

    and finally replace the code in left-mobile-menu.php with the bellow:

    <div id="mobile-menu" class="menu-panel">
    
    	<div id="mobile-menu-inner" data-titlebar="<?php echo (boss_get_option( 'boss_titlebar_position' )) ? boss_get_option( 'boss_titlebar_position' ) : 'top'; ?>">
    
    		<?php
    		if ( !is_page_template( 'page-no-buddypanel.php' ) && !(!boss_get_option( 'boss_panel_hide' ) && !is_user_logged_in()) ) {
    
    			$custom_leftbar_menu = wp_nav_menu( array(
    				'theme_location' => 'left-panel-logged',
    				'container_id'	 => 'nav-menu',
    				'fallback_cb'	 => '',
    				'depth'			 => 2,
    				'echo'			 => false,
    				'walker'		 => new BuddybossWalker
    			) );
    
    			$buddypanel_menu = wp_nav_menu( array(
    				'theme_location' => 'left-panel-menu',
    				'container_id'	 => 'nav-menu',
    				'fallback_cb'	 => '',
    				'depth'			 => 2,
    				'echo'			 => false,
    				'walker'		 => new BuddybossWalker
    			) );
    
    			echo $custom_leftbar_menu . $buddypanel_menu  ;
    		} else {
    			$custom_leftbar_menu = wp_nav_menu( array(
    				'theme_location' => 'left-panel-non-logged',
    				'container_id'	 => 'nav-menu',
    				'fallback_cb'	 => '',
    				'depth'			 => 2,
    				'echo'			 => false,
    				'walker'		 => new BuddybossWalker
    			) );
    
    			echo $custom_leftbar_menu;
    		}
    		?>
    
    	</div>
    
    </div> <!-- #mobile-menu -->

    Hope it helps, I'll try to optimize the code.

    Have a nice modding.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this question.