Create a shortcode for native WooCommerce search form

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Upd

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');

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744968338a4603819.html

相关推荐

  • Create a shortcode for native WooCommerce search form

    Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Upd

    23小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信