It enables plugin developers to create special kinds of content (e.g. forms, content generators) that users can attach to certain pages by adding the corresponding shortcode into the page text.

The API handles all the tricky parsing, eliminating the need for writing a custom regular expression for each shortcode. Helper functions are included for setting and fetching default attributes. The API supports both self-closing and enclosing shortcodes.

Shortcodes are written by providing a handler function. Shortcode handlers are broadly similar to WordPress filters: they accept parameters (attributes) and return a result (the shortcode output).

Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.

The `add_shortcode()` function is used to register a shortcode handler. It takes two parameters: the shortcode name (the string used in a post body), and the callback function name.

Three parameters are passed to the shortcode callback function. You can choose to use any number of them including none of them.



[button url=”#” style=”light” size=”small” type=”” target=”_self”]Light[/button][button url=”#” style=”aqua” size=”small” type=”” target=”_self”]Aqua[/button][button url=”#” style=”blue” size=”small” type=”” target=”_self”]Blue[/button][button url=”#” style=”green” size=”small” type=”” target=”_self”]Green[/button][button url=”#” style=”grey” size=”small” type=”” target=”_self”]Grey[/button][button url=”#” style=”red” size=”small” type=”” target=”_self”]Red[/button][button url=”#” style=”orange” size=”small” type=”” target=”_self”]Orange[/button][button url=”#” style=”purple” size=”small” type=”” target=”_self”]Purple[/button][button url=”#” style=”teal” size=”small” type=”” target=”_self”]Teal[/button]



[one_half_first][iconbox icon=”” heading=”h4″ title=”Group”]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse scelerisque facilisis neque ut pulvinar.[/iconbox][/one_half_first][one_half][iconbox icon=”” heading=”h4″ title=”Speech Bubbles”]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse scelerisque facilisis neque ut pulvinar.[/iconbox][/one_half]


Post with some shortcodes example