Shortcodes
What are shortcodes?
Shortcodes are small pieces of code that allow adding forms to the site in places blocks can't be easily added.
esFormsEntryProgress
The esFormsEntryProgress shortcode sums a numeric field from all the stored entries of a form and outputs the total against a target value, optionally with a progress bar. Useful for donation goals, sign-up counters, and similar progress indicators.
The entries feature must be enabled on the form; otherwise there is no data to read from.
Available usage:
- Anywhere shortcodes are parsed (post or page content, Shortcode block, widgets, etc.)
Available attributes:
- form_id - (string) (required) The ID of the form whose entries are counted.
- key - (string) (required) The entry field name whose values are summed.
- limit - (number) (required) The target value used to calculate the percentage. Can't be
0. - output - (string) (optional) The output format,
percentage(default) ornumber. - prefix - (string) (optional) Text shown before the value.
- suffix - (string) (optional) Text shown after the value.
- show_bar - (string) (optional) Render the progress bar,
yesorno(default). - condition_key - (string) (optional) The entry field name used to filter which entries are counted.
- condition_value - (string) (optional) The value
condition_keymust match for the entry to be counted.
Example usage:
[esFormsEntryProgress form_id="123" key="amount" limit="10000" output="number" prefix="$" show_bar="yes" /]
Counting only the entries where the status field equals paid:
[esFormsEntryProgress form_id="123" key="amount" limit="10000" condition_key="status" condition_value="paid" /]
Good to know:
- Nothing is output if
form_id,key, or a non-zerolimitis missing. - Entries with a non-numeric value in
keyare skipped. - Both
condition_keyandcondition_valuemust be provided for the filtering to apply. - The
percentageoutput is formatted with two decimals, and thenumberoutput is rounded to the nearest integer. - The value is not capped, so it can go over
100%if the sum exceeds thelimit. - Up to 10 000 entries per form are taken into account.
Output markup:
<div class="es-entry-progress">
<div class="es-entry-progress__bar">
<div class="es-entry-progress__status" style="width: 42.50%;"></div>
</div>
<div class="es-entry-progress__text">42.50%</div>
</div>
The plugin doesn't ship any styles for these classes, so style them in your theme.
esFormsLink
This shortcode allows adding links within text labels, e.g. if you need to add a privacy policy link to a form checkbox label.
Available usage:
- Form field label (e.g. checkbox label, radio label, etc.)
Available attributes:
- url - (string) (required) The URL of the link.
- label - (string) (required) The label of the link.
Example usage:
[esFormsLink url="https://eightshift.com" label="Eightshift" /]
esFormsRangeCurrent
The esFormsRangeCurrent shortcode allows showing the current value of the range input.
Available usage:
- Form field range label.
Available attributes:
- value - (string) (required) The initial value of the range.
- prefix - (string) (optional) The prefix of the range value.
- suffix - (string) (optional) The suffix of the range value.
Example usage:
[esFormsRangeCurrent value="<initialValue>" prefix="<valuePrefix>" suffix="<valueSuffix>" /]
esFormsROIP
The esFormsROIP (Result output item part) shortcode allows showing certain content inline, based on the user input. The content is shown if the provided name matches the fields defined within filters.
Available usage:
- Result output custom post type
Available attributes:
- name - (string) (required) The name of the key to check.
Example usage:
[esFormsROIP name="<key>"]Default content[/esFormsROIP]
esFormsROISF
The esFormsROISF (Result output item show form) shortcode renders a submit button inside a result output item. Use it to give users the option to re-submit the form from the result output page.
The button label is set via the shortcode content. If the es_forms_block_form_component_show_form filter is set, it will use the custom component returned by that filter instead of the default submit button.
Available usage:
- Result output custom post type
Available attributes:
- (none) — button label is set as the shortcode content.
Example usage:
[esFormsROISF]Submit again[/esFormsROISF]