So just for posterity’s sake or if anybody else wants to try this, I have since modified the code above like this, to add a ul and to make use of Chaplin’s styles for header menus.
(For more wp_nav_menu
options, confer https://developer.www.ads-software.com/reference/functions/wp_nav_menu/)
// Menu registration ...
function chaplin_custom_menu() {
register_nav_menu('chaplin-meta-menu',__( 'Meta Menu' ));
}
add_action( 'init', 'chaplin_custom_menu' );
// Menu positioning ...
function chaplin_child_chaplin_header_toggles_start() {
if ( has_nav_menu( 'chaplin-meta-menu' ) ) {
wp_nav_menu( array(
'container' => 'div',
'container_class' => 'main-menu-alt-container',
'depth' => 1,
'items_wrap' => '<ul class="main-menu-alt dropdown-menu reset-list-style">%3$s</ul>',
'theme_location' => 'chaplin-meta-menu',
) );
}
}
add_action( 'chaplin_header_toggles_start', 'chaplin_child_chaplin_header_toggles_start' );
Choose different class names for the ul if you want to use your own styles anyway. If you do use the above, make sure to set the ul to display:block
, as ist will be hidden by default otherwise.
e.g.:
.header-toggles { align-items: center; display: flex; justify-content: flex-end; }
.header-toggles .main-menu-alt-container { display: block; margin: 0 2rem 0 6rem; }