Ascend – Add Search to Secondary Menu

If using a child theme, you can add a search bar to your secondary menu by adding this function to your functions.php file. If not, you can also utilize the code-snippets plugin.

add_filter('wp_nav_menu_items', 'custom_add_search_icon_to_second_menu_ascend', 10, 2);
function custom_add_search_icon_to_second_menu_ascend($items, $args) {

	if( !($args->theme_location == 'secondary_navigation') )
		return $items;

	<li class="menu-search-icon-kt">
		<a class="kt-menu-search-btn kt-pop-modal" data-mfp-src="#kt-extras-second-modal-search" href="<?php echo home_url().'/?s='; ?>">
			<span class="kt-extras-label"><i class="kt-icon-search"></i></span>
	<?php  $output  = ob_get_contents();

	return $items . $output;
add_action('wp_footer', 'custom_add_search_form_popup_to_footer_ascend', 5);
function custom_add_search_form_popup_to_footer_ascend() { ?>
    		<div class="mag-pop-modal mfp-hide mfp-with-anim kt-search-modal" id="kt-extras-second-modal-search" tabindex="-1" role="dialog" aria-hidden="true">
	            <div class="pop-modal-content">
	                <div class="pop-modal-body">
							get_product_search_form(); ?>

If you wish to instead use a WooCommerce search, change the




To learn more about and download a free child theme, visit this child theme tutorial.