Primary

API

Functions

search_live()

Use the function search_live() to render a Search Live form in templates.

This function accepts one optional parameter. You can pass it an array of settings equivalent to those that can be provided with the shortcode. For available settings, please refer to the Shortcodes section. The names of the shortcode attributes are accepted as the indexes of the array passed to the function.

To output the Search Live form using the default settings:

<?php
  if ( function_exists( 'search_live' ) ) {
    echo search_live();
  }
?>

To output the Search Live form and allow for up to 30 results to be shown with descriptions and without thumbnails :

<?php
  if ( function_exists( 'search_live' ) ) {
    echo search_live( array( 
        'limit' => 30,
        'show_description' => 'yes',
        'thumbnails' => 'no'
    ) );
  }
?>

Filters

search_live_admin_footer

Allows to modify the footer shown in administrative screens.

Parameters:

  • $footer string HTML content

Returns:

string HTML content

search_live_cache_lifetime

Allows to modify the cache lifetime for stored results.

Parameters:

  • $cache_lifetime int seconds

Returns:

int seconds

search_live_field_title

Determines the content of the title attribute of the live search field.

Parameters:

  • $field_title string

Returns:

string field title

search_live_limit

Determines the maximum number of posts retrieved.

Parameters:

  • $limit int maximum number of posts

Returns:

int maximum number of posts

search_live_max_search_terms

Limits the number of search terms that are considered. By default, no more than 10 different terms (words) are included to provide search results.

Parameters:

  • $limit int maximum number of terms

Returns:

int maximum number of terms

search_live_no_results

Allows to modify the text shown when there are no results.

Parameters:

  • $text string text shown when there are no results

Returns:

string text

search_live_placeholder

Allows to modify the placeholder text shown in the live search field.

Parameters:

  • $text string placeholder text shown

Returns:

string text

search_live_post_types

Allows to modify the post types that are included in search results.

Parameters:

  • $post_types array

Returns:

array of strings indicating post types