Support » Plugin: Search in Place » How to block executing a search if input field is empty + search only in pages

  • Resolved halohtlo

    (@halohtlo)


    Hello there, I must say this plugin is really cool.

    I have two questions:
    Q1: How can i block executing a search if input field is empty?

    Q2: How can I search only in specific pages? Also at the current state, whenever I type something, it pops up but when I click on ” SEARCH “, it doesn’t redirect to that element but prints out all of the current pages. I must click on the element itself to get redirected.

    Thanks.

    • This topic was modified 2 years, 2 months ago by halohtlo.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    Answering to your questions:

    Q: How can i block executing a search if input field is empty?

    A: If the plugin was configured to display the results only after the users type X characters into the input box (this is configured through the attribute: “Enter the minimum of characters number for start the search” in the settings page of the plugin) the plugin will not display the results if the input box is empty.

    Q: How can I search only in specific pages?

    A: The current version of the plugin search in the same elements that WordPress. The professional version of the plugin allow you restrict the elements to search by post_type, but if this behavior is not what you need, I can offer you a custom coding service form my private website:

    https://wordpress.dwbooster.com/support

    Best regards.

    Thank you for the quick response.

    I think the default wordpress search is conflicting with this plugin and even if none characters are entered, it still executes the search. Maybe I should remove it completely and configure this plugin.

    Plugin Author codepeople

    (@codepeople)

    Hello @halohtlo,

    Could you send me the URL to your website for checking the issue in detail, please?

    Best regards.

    Sure, here it is -> https://www.avtomorgaruse.bg/

    Plugin Author codepeople

    (@codepeople)

    Hello @halohtlo,

    If you are talking about hide the search results popup after delete the characters in the search box, please, follow the steps below (the modification will be included in the next update of the plugin)

    1. Open the “/wp-content/plugins/search-in-place/js/codepeople_shearch_in_place.js” file with the text editor of your choice.

    2. Go to the piece of code:

    
    if(me.search.indexOf(v) != 0){
    	$('.search-in-place').hide();
    }
    

    and edit it as follows:

    
    $('.search-in-place').hide();
    

    3. Finally, clear the browser’s cache after edit the online file.

    Best regards.

    Hey, thanks for the help but I meant something else:

    1. When you press search without any input, all the pages pop up in the middle of the front page.

    2. When you search for something and it pops up, if you don’t click it but click on the search itself, all the pages pop up in the middle again.

    Plugin Author codepeople

    (@codepeople)

    Hello @halohtlo,

    If you press the enter key with the focus in the search box, the control is taken by WordPress and it manage the search results page by itself (and WordPress loads by default all searchable items). For example, you can disable our plugin and press the enter key with the focus in the search box.

    Best regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to block executing a search if input field is empty + search only in pages’ is closed to new replies.