Shortcode Reference

The [celersearch] shortcode embeds a search view anywhere a shortcode runs (posts, pages, widgets, page builders, theme templates via do_shortcode()).

A CelerSearch shortcode product view with color, rating, stock, and size facets beside sortable WooCommerce product results
A product View rendered by the shortcode: rich facets, sorting, product cards, and add-to-cart actions in one live search experience.

Two Modes

View-based (recommended) — loads the configuration saved in CelerSearch → Views and lets you override individual options inline:

Text
[celersearch view="3"]

Inline (fallback) — pass the config directly without creating a saved view. Useful for quick drops, throw-away pages, or when the index is the only thing you care about:

Text
[celersearch index_id="5" limit="12"]

Either the view attribute (referring to a saved view's ID) or index_id must be present. Inline attributes always override the corresponding value on a saved view.

Attributes

AttributeTypeDefaultDescription
viewint0 (unset)Saved view ID from CelerSearch → Views.
index_idint0 (unset)Index ID to search. Required when not using view.
limitint12Results per page.
placeholderstringSearch...Placeholder text for the search input.
classstring""Extra CSS classes added to the view wrapper.
show_facetsbooltrueRender the filter sidebar. Set to false to hide all facets.
highlightbooltrueWrap matching terms in <em class="celersearch-highlight"> in titles and excerpts.
debounceint300Milliseconds to wait after the last keystroke in live mode.
min_charsint2Minimum characters before a search runs in live mode.
modelive | manuallivelive searches on every keystroke (debounced). manual waits for form submit.
initial_displaysearch_only | allsearch_onlyWhat to render before the first search. search_only shows just the input; all also lists results (no query).

No legacy aliases

layout, columns, per_page, show_images, pagination_style, theme, and filter_style are not recognised — CelerSearch silently ignores unknown attributes. Use the options above and style with CSS or template overrides instead.

Examples

Use a saved view

Text
[celersearch view="2"]

Override a saved view's limit

Text
[celersearch view="2" limit="24"]

Inline without a saved view

Text
[celersearch index_id="5" limit="12" placeholder="Search articles…"]

Hide the filter sidebar

Text
[celersearch view="2" show_facets="false"]
Text
[celersearch view="2" mode="manual"]

Show results immediately on load

Text
[celersearch view="2" initial_display="all"]
Text
[celersearch view="2" debounce="150" min_chars="1"]

Using the Shortcode in PHP

PHP
<?php echo do_shortcode('[celersearch view="2"]'); ?>

Or conditionally:

PHP
<?php
if (is_user_logged_in()) {
    echo do_shortcode('[celersearch view="3"]'); // members search view
} else {
    echo do_shortcode('[celersearch view="2"]'); // public search view
}
?>

Modifying Hits & Results

Customise the data each result receives before the template renders it:

PHP
add_filter('celersearch_view_search_hit', function ($item, $post, $raw_hit, $index) {
    $item['thumbnail'] = get_the_post_thumbnail_url($post, 'medium');
    return $item;
}, 10, 4);

See celersearch_view_search_hit for the full hook reference.

Styling

Results are rendered with a theme-overridable template system. Drop a copy of any template into your-theme/celersearch/views/search/… to customise it — see Template Overrides for the full list of templates, placeholders, and filter hooks.

Validation Errors

When a view or index can't be found, or the configuration is invalid, logged-in administrators see an inline error panel rendered by views/search/error.php. Non-admins get empty output so broken shortcodes never surface to customers.