Creating Shortcodes in WordPress

Shortcodes enable developers to create special kinds of content, following the idea of macros. One very famous short code is “gallery” needed to insert a gallery of images into a post.

The good thing about shortcode’s is that final users are free to decide where to insert them.

WordPress’s Shortcode API handles all the tricky parsing, making developers life much easier. The following is a snippet for a Shortcode – in order to make it work you have to add it to your functions.php file in your theme’s directory.