Skip to content

Instantly share code, notes, and snippets.

@grantambrose
Last active December 16, 2020 17:18
Show Gist options
  • Save grantambrose/fbf6a6c8161c2d463f24a5d2614dbc9f to your computer and use it in GitHub Desktop.
Save grantambrose/fbf6a6c8161c2d463f24a5d2614dbc9f to your computer and use it in GitHub Desktop.
Add content to the vertical menu in the Beaver Builder Theme (before)
// Add a Beaver Builder Template to the bottom of the Beaver Builder Theme vertical menu
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {
// if the menu is in fact our header menu
if ($args->theme_location == 'header') {
// get the content of our Beaver Builder Template
$bb_content = do_shortcode('[fl_builder_insert_layout slug="vertical-menu-content-bottom"]');
// append the content of our Beaver Builder Template to the end of our menu
$items = $bb_content . $items;
}
// return our menu + Beaver Builder content ready for output
return $items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment