I’ve written about shortcodes before — and I love them!
You may have run into shortcodes before as many themes and plugins use shortcodes specific to their product to add theme and plugin functionality to your site.
If you are new to WordPress you may be asking….
What is a Shortcode?
A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line. Shortcode = shortcut. ~ WordPress.com
When you are creating a post and upload a bunch of photos for a gallery that you want to display on that post, you can then just use the shortcode. WordPress knows what files you’ve uploaded and “attached” to that post and will take it from there!
Shortcodes Included with WordPress
These are the shortcodes included with WordPress, what they do and how you can add attributes to customize further:
Allows you to embed audio files and play them back. You can loop (keep replaying) the audio and designate autoplay or not. Example attribute to play a file that wasn’t uploaded to that particular post:
Allows you to wrap captions around content. Generally used for one image. When you insert an image into a post and fill in the caption field you’ll see this shortcode. You can designate width and alignment with attributes. Caption Here Caption shortcode has a closing tags so that WordPress knows that the caption to display is what is between the opening and closing tag.
Can be used to embed videos, images, tweets, audio into your WordPress site. This is primarily used for YouTube videos. Attributes allow you to designate the size of video:
[embed width="123" height="456"]http://www.youtube.com/watch?XXXXXXXXXXX[/embed]
Creates a simple gallery. Example attribute:
[gallery id="123" size="medium"] or to include multiple galleries: [gallery ids="729,732,731,720"]
The playlist shortcode implements the functionality of displaying a collection of WordPress audio or video files in a post. You can use attributes to order, style and even show or hide the artist’s name.
Allows you to embed video files and play them back. Works pretty much the same as the shortcode.
Even More Stylized and Useful Shortcodes!
By adding the above shortcodes into your posts you can have the accompanying data display. Cool huh?
There are a bunch of WordPress shortcode plugins for you to choose from to add more visual components to your site.
Being most folks use WordPress because it takes the need to “know code” off the table, you also have the option to add even more functionality and visuals by using shortcodes. I know you’ll love them too!
At your service,