Skip to content

Instantly share code, notes, and snippets.

@AchalJ
Created February 26, 2021 13:59
Show Gist options
  • Save AchalJ/705adfbd9ab6cc1d3914549f3b2c62f8 to your computer and use it in GitHub Desktop.
Save AchalJ/705adfbd9ab6cc1d3914549f3b2c62f8 to your computer and use it in GitHub Desktop.
Add extra elements in Advanced Menu
// Advanced Menu - off-canvas before menu items
// First, add pp-adv-menu--extra ID to module setting > Advanced tab > ID field.
// Then add the following code in your current theme's functions.php
function wpba_demo_offcanvas_menu_before( $type, $settings, $id )
{
if ( $settings->id != 'pp-adv-menu--extra' ) {
return;
}
?>
<style>
.wpba-menu-content { margin-top: 50px; padding: 40px; padding-bottom: 10px; }
</style>
<div class="wpba-menu-content">
<div class="wpba-menu-search">
<?php echo get_search_form(); ?>
</div>
<h3>About us</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
<?php
}
add_action( 'pp_advanced_menu_before', 'wpba_demo_offcanvas_menu_before', 10, 3 );
// Advanced Menu - off-canvas after menu items
function wpba_demo_offcanvas_menu_after( $type, $settings, $id )
{
if ( $settings->id != 'pp-adv-menu--extra' ) {
return;
}
?>
<style>
.wpba-menu-content-after .fl-builder-content { padding: 0; }
.wpba-menu-content-after .fl-module-content { margin: 0; padding-left: 30px; }
.wpba-menu-content-after .pp-social-icons-center { text-align: left; }
</style>
<div class="wpba-menu-content-after">
<?php
// Please replace this shortcode with your own content or shortcode.
echo do_shortcode( '[fl_builder_insert_layout id="120218"]' );
?>
</div>
<?php
}
add_action( 'pp_advanced_menu_after', 'wpba_demo_offcanvas_menu_after', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment