Behind the GUI veneer of every WordPress website is a complex set of code that makes everything work. And while the site owner does not necessarily need to know the code in detail, there are times when knowing a little bit of code comes in handy. So thank goodness for shortcodes.
This post is the first in a series of seven that will introduce you to shortcodes. Once you learn how to use them, you will have the ability to do some pretty cool things without using a third-party plugin.
A Brief Explanation
A shortcode is a very small piece of code that can be implemented on a page or post without having to know any complicated syntax or coding vocabulary. Think of shortcodes as the shorthand of web development. Plug-in users make use of them by creating their own codes that refer to their configuration files for functionality.
For example, a calendar plugin known as ‘Events Made Easy’ uses a simple shortcode to display the site owner’s calendar. Pasting a simple code that may look something like [ ai1ec view=”monthly” ] on a single page displays the monthly calendar without any need to know complex coding. The site owner uses the plugin’s GUI to create events that will be added to the calendar and displayed on the designated page.
Shortcodes Recognized by WordPress
The example shortcode listed above is one that is unique to that plugin. WordPress only knows what to do with it because the plugin’s configuration files provide the necessary instructions. However, there are six shortcodes that WordPress recognizes by default. These are as follows:
- [ audio ] – Use this shortcode to insert one or more audio files into a page or post. There are multiple parameters that can be used to do things such as looping and autoplay.
- [ caption ] – The caption shortcode makes it possible to assign captions to your content. It is especially helpful for captioning images in which wraparound text is applied.
- [ embed ] – If you want to embed wrapped items on a page or post, use this shortcode. You can use it to set maximum width and height for the best presentation.
- [ gallery ] – The gallery shortcode can be deployed to create an image gallery in a post or page. Insert one image or multiple images from your media library.
- [ playlist ] – The purpose of the playlist shortcode is to present users with a set of audio or video files they can choose from within a page or post. Think of it in the same terms as a playlist presented by a multimedia player.
- [ video ] – The video shortcode is similar to the audio shortcode except that its purpose is to embed videos in your pages and posts. It also offers several different parameters that add functionality.
Be sure to check out our next post as we explain the audio shortcode in more detail. It offers quite a bit of functionality that can truly spice up your site.