News

Post with some shortcodes example

Introduced in WordPress 2.5 is the Shortcode API, a simple set of functions for creating macro codes for use in post content. For instance, the following shortcode (in the post/page content) would add a photo gallery into the page:

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.

Buttons

LightAquaBlueGreenGreyRedOrangePurpleTeal

Iconboxes

Group

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse scelerisque facilisis neque ut pulvinar.

Speech Bubbles

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse scelerisque facilisis neque ut pulvinar.

 

Top

Leave a Reply

Top