Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › How can I set up the home page' Search to "search product only"
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › How can I set up the home page' Search to "search product only"
- This topic has 5 replies, 4 voices, and was last updated 10 years by Kyle – SUPPORT.
-
Posted in: Neighborhood
-
November 25, 2014 at 1:07 am #130703
Hi Neighbor;
wondering how can I set up the home page’ Search to “search product only”? now when I search something, the products shown in the search result are more like a post (ie. has date, comment and like under the product name, and no price shows) rather than a product.
Hope I make myself clear, please kindly advise.
Thanks & Regards
JohnnyNovember 25, 2014 at 5:58 am #130737Hi,
Please paste given below code at functions.php of child theme.function sf_main_menu($id, $layout = "") { // VARIABLES $options = get_option('sf_neighborhood_options'); $show_cart = $options['show_cart']; $show_wishlist = $options['show_wishlist']; $disable_search = false; if (isset($options['disable_search'])) { $disable_search = $options['disable_search']; } $menu_output = $menu_full_output = ""; $main_menu_args = array( 'echo' => false, 'theme_location' => 'main_navigation', 'fallback_cb' => '' ); // MENU OUTPUT if ($id == "mini-navigation") { $menu_output .= '<nav id="'.$id.'" class="mini-menu clearfix">'. "\n"; } else { $menu_output .= '<nav id="'.$id.'" class="clearfix">'. "\n"; } if(function_exists('wp_nav_menu')) { $menu_output .= wp_nav_menu( $main_menu_args ); } $menu_output .= '</nav>'. "\n"; // FULL WIDTH MENU OUTPUT if ($layout == "full") { $menu_full_output .= '<div class="container">'. "\n"; $menu_full_output .= '<div class="row">'. "\n"; $menu_full_output .= '<div class="span9">'. "\n"; $menu_full_output .= $menu_output . "\n"; $menu_full_output .= '</div>'. "\n"; $menu_full_output .= '<div class="span3 header-right">'. "\n"; if ($id == "mini-navigation") { $menu_full_output .= '<nav class="mini-menu">'. "\n"; } else { $menu_full_output .= '<nav>'. "\n"; } $menu_full_output .= '<ul class="menu">'. "\n"; if (!$disable_search) { $menu_full_output .= '<li class="menu-search no-hover"><a href="#"><i class="fa-search"></i></a>'. "\n"; $menu_full_output .= '<ul class="sub-menu">'. "\n"; $menu_full_output .= '<li><div class="ajax-search-wrap"><div class="ajax-loading"></div><form method="get" class="ajax-search-form" action="'.home_url().'/shop/"><input type="text" placeholder="'.__("Search", "swiftframework").'" name="s" autocomplete="off" /></form><div class="ajax-search-results"></div></div></li>'. "\n"; $menu_full_output .= '</ul>'. "\n"; $menu_full_output .= '</li>'. "\n"; } if ($show_cart) { $menu_full_output .= sf_get_cart(); } if ( class_exists( 'YITH_WCWL_UI' ) && $show_wishlist) { $menu_full_output .= sf_get_wishlist(); } $menu_full_output .= '</ul>'. "\n"; $menu_full_output .= '</nav>'. "\n"; $menu_full_output .= '</div>'. "\n"; $menu_full_output .= '</div>'. "\n"; $menu_full_output .= '</div>'. "\n"; $menu_output = $menu_full_output; } // MENU RETURN return $menu_output; }
It will work as you want.
Thanks
MohammadNovember 25, 2014 at 2:19 pm #130916Thanks Mohammad; just to confirm, do I add them in
Custom CSS
Quickly add some CSS to your theme by adding it to this textarea.”
area? copy n paste? I am really a layman…November 25, 2014 at 2:56 pm #130945You need to use a child theme and add to the functions.php file of the child theme
– Kyle
December 5, 2014 at 8:16 pm #133908Hi Kyle.
If in search window click in bottom link “View all ### results” it return the page with non-product search result. Any way to fix it?
Thanks!
December 8, 2014 at 8:52 am #134154Hi
Please ignore all of the above, there’s now an option in the theme options to return only product search results
– Kyle
-
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.