Snippets: Add/Remove Elements From The Sidebar Mobile Menu

/**
 * Sample function to add/remove items from the sidebar mobile menu
 * @link Total/framework/core.php
 */
function my_add_to_mobile_menu( $array ) {
 
    // Add element with ID my-custom-id
    $array['my-custom-id'] = '#my-custom-id';

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

}
add_filter( 'wpex_mobile_menu_source', 'my_add_to_mobile_menu' );

Snippet Type: PHP

Posted Under: Mobile

All PHP snippets should be added via a child theme's functions.php file.