Setting Live Search in Wordpress

I have added live search element in my header in 2 different pages, but I need to set query on these queries.

Query 1:

https://www.foodiy.my/products/ need to show only products. (search within all products. exclude posts or portfolio)


Query 2:

https://www.foodiy.my/recipes/ need to show only posts (search within all posts, exclude products, exclude portfolio).


Not sure if above explanation is clear.

Thank yoU!!

Comments

  • Hi,

    There is no option for that, but results can be hidden with a custom CSS code for the live search box.

    Please let me know if you need help with writing such code, but please note that it will have no effect on the search page and all results will appear there.


    Best regards

  • if results can be hidden with custom css code, I wish to try it out. Can help me on the custom css code? what info should I give you to write the css code?


    Thanks so much

  • No additional info is needed. Please use the following CSS code:

    .blog .mfn-live-search-box .mfn-live-search-list > li:not(.mfn-live-search-list-blog){
     display: none!important;
    }
    .page-id-212 .mfn-live-search-box .mfn-live-search-list > li:not(.mfn-live-search-list-shop){
     display: none!important;
    }
    

    Put it in Betheme -> Theme options -> Custom CSS & JS -> CSS.


    Best regards

  • Sorry... it is still showing all search results as before. Have I missed out anything?


  • What do you mean it shows all results?

    Take a look, I am on the products page, and it shows products only:

    On the blog, it shows posts only:

    Best regards

  • I see. while entering data in the search in product page, it showed only products, but upon ENTER, the search results showed everything.


  • Yes, that is what I meant in my first message, that the search results page cannot be modified this way and will show everything.


    Best regards

  • I see... if not using live search... what other element can I consider?

  • This is the only search element we provide. If you would like to have different functionalities, you would have to use an external plugin, but we cannot recommend any plugins other than the ones we support.

    https://support.muffingroup.com/documentation/bundled-plugins/#compatibility


    Best regards

Sign In or Register to comment.