WidgetCoreWidgetCore Documentation

The wgcr_search shortcode

The complete reference for the [wgcr_search] shortcode — all 24 attributes with defaults and allowed values, boolean parsing, practical examples, the PHP function and validation rules.

The [wgcr_search] shortcode renders exactly the same search field as the Elementor widget, but you can use it anywhere: inside content, in a theme template or in another plugin. Every attribute is optional.

[wgcr_search]
[wgcr_search source="course" limit="9" columns="3" mode="page"]
[wgcr_search terms="category:12,category:18" terms_op="include" date="year"]

Complete attribute table

AttributeDefaultAllowed valuesDescription
sourcepostAny public, searchable post typeThe source of results
placeholderAutomaticAny textWhen empty: “Search posts…”, or “Search courses…” for course
limit5A number 1 to 50Results per page
columns1A number 1 to 6Only with mode="page"
masonrynoyes / noOnly with mode="page"
equal_heightnoyes / noOnly with mode="page" and when masonry is off
thumbyesyes / noShow the thumbnail
excerptyesyes / noShow the excerpt
all“Show all results”Any textLabel of the link to the full results page
template0An Elementor template idRender results with a custom template
modemodalmodal / pageDisplay mode of results
orderbyrelevancerelevance, date, title, author, rand, menu_orderResult ordering
orderDESCDESC / ASCSort direction
dateallall, week, month, yearDate range
termsEmpty[taxonomy:]id, comma separatedCategory or tag filter
terms_opexcludeinclude / excludeInclude or exclude
ignore_stickyyesyes / noWith no, sticky posts come first
query_idEmptyA simple key (sanitize_key)For the wgcr_search_query_args/{query_id} filter
paginationnonenone, numbers, prev_next, load_on_click, load_on_scrollPagination type
spacernoyes / noExtra space before pagination
more_text“View more posts”Any textLabel of the “load more” button
more_iconyesyes / noIcon on the button
more_idEmptyLetters, numbers, - and _HTML id of the button
no_more“There are no more posts.”Any textMessage shown at the end of results

Boolean values

The four words yes, 1, true and on are treated as true; everything else is false:

[wgcr_search thumb="1"]
[wgcr_search thumb="true"]
[wgcr_search thumb="on"]
[wgcr_search thumb="yes"]

Examples

A simple search across posts

[wgcr_search]

A course search with a three-column grid

[wgcr_search source="course" mode="page" limit="9" columns="3" equal_height="yes"]

Results only from two specific categories

[wgcr_search terms="category:12,category:18" terms_op="include"]

Last year's results with numbered pagination

[wgcr_search date="year" orderby="date" pagination="numbers" limit="12"]

Results with an Elementor template and equal height

[wgcr_search mode="page" template="42" columns="2" equal_height="yes"]

Excluding a tag

[wgcr_search terms="post_tag:7" terms_op="exclude"]

Using it from PHP

The shortcode is backed by a public render function you can call directly:

php
echo wgcr_search_render(
	array(
		'source'  => 'post',
		'limit'   => 6,
		'mode'    => 'modal',
		'columns' => 1,
	),
	'homepage'
);
ArgumentTypeNotes
$argsarrayThe same keys as the shortcode attributes
$idstringA unique identifier; when empty the plugin generates sc1, sc2, …

The $id argument matters when you render several searches on one page from PHP: each instance needs a unique root id, otherwise the panels conflict.

Differences from the Elementor widget

FeatureWidgetShortcode
Style controlsFull Elementor panelNone (style with CSS)
Columns1 to 31 to 6
Default items per page125
Default display modeList modemodal
Template choice controlYesWith the template attribute
Query IDYesYes
Works outside ElementorNoYes

Because the shortcode has no style panel, its output relies on the classes on the styling page plus the more_text, more_icon and more_id attributes for the load-more button.

Value validation

Nothing you write reaches the query unfiltered:

AttributeValidation
sourceOnly public, searchable post types; attachment and elementor_library are excluded; anything else becomes post
limitCast to an integer and clamped to 1–50
columnsClamped to 1–6
modeOnly modal or page
orderbyA whitelist of six values, otherwise relevance
orderOnly ASC or DESC
dateOnly all, week, month, year
termsEach item is parsed and cast to a positive integer
terms_opOnly include or exclude
query_idPassed through sanitize_key
more_idOnly letters, numbers, - and _
Text attributesEscaped for the attribute or HTML context they are printed in