Home Forums Pro Themes Clean Commerce Pro Add input in default search form located in header

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #49713
    Donna Ng
    Participant

    Basically I want the search form to query the products and not the posts. In order to achieve this I imagined adding an hidden input in the search form to specify the target as below:

    <input type="hidden" name="post_type" value="product">

    I have implemented a few options but none of them works such as creating a new searchform.php file at the root of my child theme or adding a filter in functions.php file on ‘get_search_form’.

    Any suggestions?

    #49937
    wensolutions
    Keymaster

    Hello @quintorium,

    To make the search form search the product use you have to activate the child theme .

    Child theme references :

    https://codex.wordpress.org/Child_Themes

    You can also create the child theme using the plugin . Below is the link to one of them.

    https://wordpress.org/plugins/wp-child-theme-generator/

    After creating the child theme in your child theme functions.php file paste below given code.

    https://gist.github.com/anonymous/5e2063ef14efb06f2989cbe0937c3fb0

    Hope this helps.

    Let us know if you have any confusion further .

    Best Regards!!

    #49940
    Donna Ng
    Participant

    This is exactly what I wanted. It works like a charm.

    Thanks for your help.

    Cheers

    #49942
    wensolutions
    Keymaster

    Hello @quintorium,

    Glad we could help you !!

    If you have any issues further, please feel free to post your queries and we will happily help you further.

    We will really appreciate if you could help us too by rating our theme in WordPress repo here:-

    https://wordpress.org/support/theme/clean-commerce/reviews/

    Best regards !!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.