Knowledge Base

How to use filters only and hide the search bar?

in Ajax Search Pro Tips Tags: displayfiltersinvisibleonlysearch

Plugin version 4.8 and later

On the Layout Options -> Search Box layout panel, you can completely disable the search box, leaving only the settings visible.

hide-search-box-ajax-search-pro

Before plugin version 4.8

You will need to apply a few lines of custom CSS code and a custom function to your themes functions.php file.

Custom CSS

IMPORTANT: Add this custom CSS to the search theme options panel, it won't work anywhere else!

kb_asp_css

Use the search instace you want to hide, you can still have other visible search instances with this custom css:

#ajaxsearchpro_aspid {
    display: none;
}

Function to reset the search phrase

Put this function into the functions.php file in your active theme directory. It's located in wp-content/themes/theme-name/functions.php

add_filter("asp_final_phrases", "asp_add_empty_phrase", 1, 1);

function asp_add_empty_phrase($phrases_array) {
    if ( empty( $phrases_array ) )
        return array("");
    return $phrases_array;
}

Additional settings

  1. Allow the plugin to trigger the search with 0 characters entered:
    kb_asp_css2
  2. Set the settings layout to “block or custom” and make it visible by default:
    kb_asp_css3