Site logo

Archived topic

Updated code for Navigation Search in Secondary Navigation

1 reply · Started by Natalie on September 22, 2019

Viewing posts 1–2 of 2

Now that you can use SVG as the icon for search, I think the code in Use Navigation Search in Secondary Navigation
needs an update.

I have used

    if ( $args->theme_location == 'secondary' ) {
			$icon = generate_get_svg_icon( 'search', true );
			return $nav . '<li class="search-item" title="' . esc_attr_x( 'Search', 'submit button', 'generatepress' ) . '"><a href="#">' . $icon . '<span class="screen-reader-text">' . _x( 'Search', 'submit button', 'generatepress' ) . '</span></a></li>';
    }

instead of the original

	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>';
	}

Note that the code is also referenced here:

https://gist.github.com/generatepress/38a3d4d0e3f1be118cac76937e4c92e6#file-gistfile1-txt

Thanks for the heads up! Updated :)

This archived topic is closed to new replies.