[Support request] search in secondary navigation

Home Forums Support [Support request] search in secondary navigation

Home Forums Support search in secondary navigation

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #630353
    Nikolaj

    dear Generate Press,
    I cannot send through the account issue form so here’s an email:

    When adding this code to my child theme’s function (as suggested by Leo) the search function doesn’t work on mobile?

    add_action( 'after_setup_theme', 'tu_move_nav_search' );
    function tu_move_nav_search() {
    	remove_action( 'generate_inside_navigation', 'generate_navigation_search' );
    	add_action( 'generate_inside_secondary_navigation', 'generate_navigation_search' );
    	remove_filter( 'wp_nav_menu_items', 'generate_menu_search_icon', 10, 2 );
    }
    
    add_filter( 'wp_nav_menu_items', 'tu_secondary_menu_search_icon', 10, 2 );
    function tu_secondary_menu_search_icon( $nav, $args ) {
    	$generate_settings = wp_parse_args(
    		get_option( 'generate_settings', array() ),
    		generate_get_defaults()
    	);
    
    	if ( 'enable' !== $generate_settings['nav_search'] ) {
    		return $nav;
    	}
    
    	if ( $args->theme_location == 'secondary' ) {
    		return $nav . '<li class="search-item" title="' . esc_attr_x( 'Search', 'submit button', 'generatepress' ) . '"><a href="#"><span class="screen-reader-text">' . _x( 'Search', 'submit button', 'generatepress' ) . '</span></a></li>';
    	}
    
    	return $nav;
    }
    

    Have a pleasant day…

    Nikolaj

    #632050
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Sorry for not getting back to you sooner! This topic must have slipped through the cracks.

    Can you send us the username and password in order to view your site?: https://generatepress.com/contact

    #632603
    Tom
    Lead Developer
    Lead Developer
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.