Skip to main content

Shortcode & element hooks

Hooks fired by the Shortcodes extension and individual elements: altering a shortcode's options before the modal renders, filtering an element's atts/HTML at render time, registering shortcode data for the builder, and the dynamic-content token pass.

The most common one adds or wraps an element's options:

add_filter( 'fw_shortcode_get_options', function ( $options, $shortcode ) {
if ( $shortcode === 'button' ) {
$options['my_extra'] = array( 'type' => 'text', 'label' => 'Extra' );
}
return $options;
}, 10, 2 );

To transform an element's resolved atts at render time (where dynamic-content tokens resolve), hook fw_shortcode_render_view:atts.

Actions (6)

HookPasses to your callbackWhat it does
fw_ext_shortcodes_enqueue_static_beforesee source(@since 1.3.26)
fw_ext_shortcodes_enqueue_static:see sourceunysonplus/framework/extensions/shortcodes/class-fw-extension-shortcodes.php
fw_ext_shortcodes_enqueue_static:buttonsee sourceMust be exactly the same as https://github.com/ThemeFuse/Unyson-Shortcodes-Extension/blob/v1.3.19/class-fw-extension-shortcodes.php#L226-L237
fw_newsletter_subscribe$email, $name, $listIntegrations (Mailchimp, etc.) hook here. Return a WP_Error from the fw_newsletter_subscribe_result filter to surface a failure to the user.
fw:ext:shortcodes:enqueue_custom_contentunysonplus/framework/extensions/shortcodes/class-fw-extension-shortcodes.php
fw:ext:shortcodes:enqueue-shortcodes-admin-scriptsunysonplus/framework/extensions/shortcodes/helpers.php

Filters (28)

HookPasses to your callbackWhat it does
fw_ext_shortcodes_codersarray()unysonplus/framework/extensions/shortcodes/class-fw-extension-shortcodes.php
fw_ext_shortcodes_column_descriptionsee sourceunysonplus/framework/extensions/shortcodes/shortcodes/column/includes/page-builder-column-item/class-page-builder-column-item.php
fw_ext_shortcodes_column_title$value['title'], $keyunysonplus/framework/extensions/shortcodes/shortcodes/column/includes/page-builder-column-item/class-page-builder-column-item.php
fw_ext_shortcodes_disable_shortcodesarray()unysonplus/framework/extensions/shortcodes/class-fw-extension-shortcodes.php
fw_ext_shortcodes_table_max_columns6unysonplus/framework/extensions/shortcodes/shortcodes/table/includes/fw-option-type-table/class-fw-option-type-table.php
fw_ext:shortcodes:collect_shortcodes_data$structureunysonplus/framework/extensions/shortcodes/class-fw-extension-shortcodes.php
fw_ext:shortcodes:config_shortcode$config, $tagunysonplus/framework/extensions/shortcodes/class-fw-extension-shortcodes.php
fw_newsletter_handledfalse, $email, $name, $listNotify the site (uses the Mailer extension's SMTP through wp_mail). fw_newsletter_handled lets an integration suppress this email.
fw_newsletter_recipientget_option( 'admin_email' ), $email, $listunysonplus/framework/extensions/shortcodes/shortcodes/newsletter/class-fw-shortcode-newsletter.php
fw_newsletter_subscribe_resulttrue, $email, $name, $listunysonplus/framework/extensions/shortcodes/shortcodes/newsletter/class-fw-shortcode-newsletter.php
fw_option_type_table_allowed_cell_htmlsee sourceunysonplus/framework/extensions/shortcodes/shortcodes/table/includes/fw-option-type-table/class-fw-option-type-table.php
fw_option_type_table_defaultssee sourceunysonplus/framework/extensions/shortcodes/shortcodes/table/includes/fw-option-type-table/class-fw-option-type-table.php
fw_shortcode_atts$atts, $content, $this->tag@deprecated Since Shortcodes 1.3.0
fw_shortcode_column_thumbnails_data$column_thumbnailsunysonplus/framework/extensions/shortcodes/shortcodes/column/includes/page-builder-column-item/class-page-builder-column-item.php
fw_shortcode_get_options$this->options, $this->tagunysonplus/framework/extensions/shortcodes/includes/class-fw-shortcode.php
fw_shortcode_map_providersee sourceunysonplus/framework/extensions/shortcodes/shortcodes/map/class-fw-shortcode-map.php
fw_shortcode_render_viewsee sourceunysonplus/framework/extensions/shortcodes/includes/class-fw-shortcode.php
fw_shortcode_render_view:atts$atts, $this->tagunysonplus/framework/extensions/shortcodes/includes/class-fw-shortcode.php
fw:ext:shortcodes:table:button-shortcode-name'button'If you disable default shortcode 'button' and create your own shortcode use this filter to specify its name. Fixes https://github.com/ThemeFuse/Unyson/issues/2056
sc_needs_wrapperfalse, $attsunysonplus/framework/extensions/shortcodes/includes/shortcode-styling-helper.php
sc_notification_default_iconssee sourceunysonplus/framework/extensions/shortcodes/shortcodes/notification/views/view.php
sc_notification_default_labelssee sourceunysonplus/framework/extensions/shortcodes/shortcodes/notification/views/view.php
sc_posts_query_args$args, $atts'pin_top' and 'ignore' are handled at render time / via ignore_sticky_posts already set.
sc_smooth_scroll_post_types[ 'page', 'post' ]unysonplus/framework/extensions/shortcodes/includes/shortcode-smooth-scroll.php
sc_theme_settings_url$url, $contextunysonplus/framework/extensions/shortcodes/includes/shortcode-styling-helper.php
unysonplus_components_settings_optionssee sourceunysonplus/framework/extensions/shortcodes/includes/components-options.php
unysonplus_editor_list_formats$stylesunysonplus/framework/extensions/shortcodes/includes/class-fw-shortcodes-editor.php
unysonplus_force_list_styles_cssfalseunysonplus/framework/extensions/shortcodes/includes/class-fw-shortcodes-editor.php