{"id":86,"date":"2016-12-19T22:19:51","date_gmt":"2016-12-19T22:19:51","guid":{"rendered":"http:\/\/docs.generatepress.com\/?post_type=kp_articles&p=86"},"modified":"2023-06-01T22:31:49","modified_gmt":"2023-06-01T22:31:49","slug":"navigation-search","status":"publish","type":"keep_articles","link":"https:\/\/docs.generatepress.com\/article\/navigation-search\/","title":{"rendered":"Navigation Search"},"content":{"rendered":"\n
This feature has been replaced with the Navigation Search Modal<\/a> feature introduced in GeneratePress 3.3.0<\/a><\/strong><\/p>\n\n\n\n The Navigation Search<\/strong> option can be found in Appearance > Customize > Layout > Primary Navigation<\/strong>.<\/p>\n\n\n\n This option adds a search icon (magnifying glass) to your navigation bar. When you click it, a semi-transparent search bar covers your menu items and allows you to enter a term to search your site.<\/p>\n\n\n\n By default the navigation search is located in primary navigation, the snippet below allows you to move it to the secondary navigation.<\/p>\n\n\n\n Please note that the navigation search option should be activated under Layout > Primary Navigation in order for the snippet to work:<\/em><\/p>\n\n\n\n Learn how to add PHP here<\/a>.<\/p>\n","protected":false},"template":"","yoast_head":"\nUse Navigation Search in Secondary Navigation<\/h3>\n\n\n\n
add_action( 'wp', function() {\n if ( 'enable' === generate_get_option( 'nav_search' ) ) {\n remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' );\n add_action( 'generate_secondary_menu_bar_items', 'generate_do_navigation_search_button' );\n\n remove_action( 'generate_inside_navigation', 'generate_navigation_search' );\n add_action( 'generate_inside_secondary_navigation', 'generate_navigation_search' );\n }\n}, 20 );\n<\/code><\/pre>\n\n\n\n