Shortcodes

Components as shortcodes are available starting from version 3.0. This means that spx can be now used in even more places. Using shortcodes is not much different than using web components themselves.

[spx-accordion header-text="I was made with a shortcode"] <spx-accordion header-text="I was made with a shortcode"/>

The code above would render the same accordion component. It is also possible to use enclosing shortcodes where applicable:

[spx-accordion] <div slot="header">My custom header</div> [/spx-accordion] <spx-accordion> <div slot="header">My custom header</div> </spx-accordion>

Shortcodes can also make use of PHP helpers, without writing any PHP! For example, to render a Masonry from an ACF field, simply add the arguments of the helpers as a comma seperated string to the attribute:

[spx-masonry images="my_gallery, acf" type="acf"]