最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Create a shortcode for native WooCommerce search form

programmeradmin3浏览0评论
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 question

How 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 question

How 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 badges
Add a comment  | 

1 Answer 1

Reset to default 1

Add 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');
发布评论

评论列表(0)

  1. 暂无评论