WidgetCoreWidgetCore Documentation

Shortcodes

Every WidgetCore shortcode on one page — [wgcr_search], [wgcr_comments] and [wgcr_template], what each one is for, the rules they share, examples and links to the complete guide of each shortcode.

Shortcodes place WidgetCore widgets anywhere on your site without Elementor: inside post or page content, in a theme template, or with do_shortcode() in PHP. This page lists every shortcode and the rules they share. A shortcode that needs a longer explanation has its own page under this one.

All shortcodes

ShortcodeWidget equivalentUseComplete guide
[wgcr_search]Live SearchA live search field with results in a popup or on the pageThe wgcr_search shortcode
[wgcr_comments]CommentsThe comment list and the comment formThe section below and the Comments widget
[wgcr_template]Tabs (the "Elementor template" content type)Prints a saved Elementor library template with its stylesThe section below

The FAQ widget has no shortcode; it works in Elementor only.

Rules they share

  • Every attribute is optional. An attribute you leave out takes its default value.
  • Yes/no values: yes, 1, true and on count as “yes”; any other value is “no”. This is the same in both shortcodes.
  • An invalid value never raises an error. A wrong or out-of-range value silently falls back to the default or to the nearest allowed value.
  • Styling: the Style tab sections exist only in the Elementor widget. A shortcode uses the default look and can be changed with custom CSS.
  • Assets load only on a page where the shortcode is printed.

The search shortcode

[wgcr_search] is the Live Search widget. The result source (source), the count (limit), the display mode (mode), columns, terms, date range and order are set with attributes.

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

The complete table of 24 attributes, the allowed values, the PHP function, the differences from the widget and value validation are on the The wgcr_search shortcode page.

The comments shortcode

[wgcr_comments] puts the comment list and form outside Elementor. Its attributes use the same IDs as the widget controls (form, list, title, author, email, url, cookies, author_required, email_required, rows, submit, per_page, order, avatar, reply, login_only, post and more). The full list with defaults is on the Comments widget page.

[wgcr_comments]
[wgcr_comments form="no" list_title="Reader comments" avatar="no"]
[wgcr_comments post="42" list="no" email_required="no"]
  • The extra attribute post is the ID of another post; it defaults to the current post.
  • Only one comment form is printed per page; later instances print just the list.
  • Saving a comment, spam checks and approval are still done by WordPress itself; the shortcode only sets the look and the fields of the form.

The Elementor template shortcode

[wgcr_template] prints a template saved in the Elementor library (elementor_library) together with its styles. The Tabs widget uses this same shortcode for its "Elementor template" content type, and you can place any template inside a post, a page or a theme template.

[wgcr_template id="123"]
  • Its only attribute is id, the numeric ID of a published template; an invalid ID, a draft or a deleted template prints nothing.
  • The output is built through Elementor's official API (get_builder_content_for_display), so the template's own scripts and styles come along.

Using them in PHP and theme templates

Any shortcode can be printed from a theme template or another plugin:

php
echo do_shortcode( '[wgcr_search mode="page" columns="3" limit="12"]' );
echo do_shortcode( '[wgcr_comments rows="4"]' );
echo do_shortcode( '[wgcr_template id="123"]' );

New shortcodes

Every widget that gets a shortcode is added to the table above. If its explanation is long, it gets its own page under this one, like The wgcr_search shortcode.