Skip to content

Snippet: Add/Remove Elements from the Sidebar Mobile Menu

Important: This snippet is specifically if you want to add extra content to the sidebar mobile menu via code. You can also insert content to the mobile menu including shortcodes and templates via Theme Panel > Custom Actions without any code needed.
 * Sample function to add/remove items from the sidebar mobile menu
 * @link Total/framework/core.php
add_filter( 'totaltheme/mobile/menu/sidr/source', function( $array ) {
    // Add element with ID my-custom-id
    $array['my-custom-id'] = '#my-custom-id';

    // Remove search
    if ( isset( $array['search'] ) ) {
    // Return items
    return $array;

} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top