Site logo

Archived topic

search in secondary navigation

2 replies · Started by Nikolaj on July 23, 2018

Viewing posts 1–3 of 3

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

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

This archived topic is closed to new replies.