Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this questionHow can I create a shortcode for the native WooCommerce search form, so that it can be used elsewhere? In the secondary menu, for example.
Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this questionHow can I create a shortcode for the native WooCommerce search form, so that it can be used elsewhere? In the secondary menu, for example.
Share Improve this question edited Nov 26, 2019 at 5:33 butlerblog 5,1213 gold badges28 silver badges44 bronze badges asked Nov 25, 2019 at 3:54 aye ceeaye cee 15912 bronze badges1 Answer
Reset to default 1Add this code to functions.php. You can then use the shortcode [search_form], or whatever you choose to name it, in a menu. I used it in the navigation label field of a custom link.
function search_form_shortcode() {
return get_product_search_form(false);
}
add_shortcode('search_form', 'search_form_shortcode');
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744968338a4603819.html
评论列表(0条)