Primary menu wrap


Hi,

I try but dont know how to do this:

I make preheader (beans_fixed_wrap[_header]_prepend_markup), secondary(beans_header_append_markup) and footer menu(beans_fixed_wrap[_footer]_prepend_markup) wrap and that work good, when i deselect this menus the wrap dissapears, that is good. But how to do this in the primary navbar menu ( beans_primary_menu( )), how is the name of this wrap? I want to make this:

  • i have custom menu, when i select this menu is visible, but when i deselect, then is visible menu from beans
  • also when i dont using my custom menu, and also when i dont select any primary menu in wordpress the beans primary menu is still visible ( in my project must be not)
  • how to make beans menu invisible or removed and only make this wrap, position empty for hooking my own navbar menu ? The logo and header must be on , but without beans menu.

Thiery help me please, or someone else.

Is there any scheme of all possible wraps in beans framework?

IS POSSIBLE WHEN IN COSTUMIZER OR WORDPRESS DISABLE (not select any menu) PRIMARY MENU, then will be main menu primary navbar empty(dissapear)?

Edited 9 months, 2 weeks ago by Boris Novak


I think there is a bug in Beans. If there is created in Wordpress another menus, and I disable (not select) Primary menu in Wordpress, then is in Beans navbar primary selected, viewed last another menu, but when I delete all another menus from Wordpress, then if I disable primary menu, cant be disabled, is VISIBLE only Primary Menu( last menu which is in wordpress).

I noticed also, that when I delete all menus in Beans is automatically created Navigation menu. How to disable that in Beans , when no menues is selected, then also no menues is show in theme?

Edited 9 months, 2 weeks ago by Boris Novak


Hi Boris,

This isn't a bug in Beans, it is actually an intentional behaviour. WordPress creates a "fake" menu by default if all menus are removed but it unfortunately doesn't listen to Beans menu walker. Therefore, Beans registers a default menu properly to avoid all sorts of warnings and incorrect styling. As usual, you may change this behaviour by remove the registration as follow:

// Remove default menu registration.
beans_remove_action( 'beans_do_register_default_menu' );

// Remove Beans empty menu notice.
add_filter( 'beans_primary_menu_args', 'example_primary_menu_args' );
add_filter( 'beans_primary_offcanvas_menu_args', 'example_primary_menu_args' );

function example_primary_menu_args( $args ) {
    $args['fallback_cb'] = false;

    return $args;
}

Note that I also changed the empty menu argument in the snippet so that no notice is displayed 😉

Happy coding,


Thank you for that.

Write a reply

Login or register to write a reply, it's free!