What Are WordPress Shortcodes – and How Do I Use Them?

New to WordPress and wondering what WordPress shortcodes are? All your WordPress buddies talking about how great shortcodes are whilst you’re left pleasantly smiling along wondering what on earth they’re talking about? Don’t worry – we’ve got you covered: by the end of this brief article, you too will understand the power of the humble, highly-undervalued WordPress shortcode!

What are WordPress shortcodes?

In short, WordPress shortcodes are special tags (short bits of code) that allow users to quickly and easily pull bits of predefined functionality into their content. Hmmm… too abstract? How about an example? – let’s say you’ve got a theme (or plugin) that allows you to insert a bunch of cool things into your posts or pages*, like tooltips (those little boxes of extra information that sometimes appear when you hover over things), column layouts, galleries, buttons, pullquotes, blockquotes, social media buttons, etc, etc, …well, likely as not, the way you’d go about inserting such bits of predefined functionality is by writing a shortcode – or by using some kind of graphical interface (usually accessible by clicking on some icon or other located above the visual editor — assuming such an icon exists) to automatically generate a specific shortcode for you.

What does a shortcode look like?

Usually something like this (note the square brackets):

[recent-posts]

…which when viewed on a website would – assuming such a shortcode had been created/predefined for it do so – display a selection of the author’s most recent posts wherever on the post/page they choose to write it.

So what kinds of things can you do with shortcodes?

In short, a shortcode will let you access whatever kind of functionality whoever created the shortcode defined it to have – which could be from something as simple as inserting an icon or changing the color of some text, to inserting an all-singing all-dancing gallery of images that slide across the page looking absolutely fabulous!

For example:

A great example where using shortcodes can really make a difference is in the creation of page layouts: it’s not at all uncommon to be browsing a website these days and come across a full-width page displaying paragraph after paragraph of text spanning the entire width of the page – thereby screaming to whoever’s just found it ‘I AM A HUGE MASS OF UNREADABLE TEXT’! With a decent set of layout-type shortcodes at their disposal, there’s really no decent reason why authors need ever lay out their pages like this. Why not narrow things down a bit with a few column shortcodes? Insert a few tabs and accordions perhaps – thereby lessening the impact of all that text? Or perhaps add a few images in a slider or gallery to make the whole page a bit more visually appealing? Maybe even add a drop-cap or two?

So shortcodes are obviously pretty sweet. . . where can I get some?

It’s possible that the theme your currently using actually already has a bunch of shortcodes built into it – yes really! To find out if this is the case go back to wherever you bought your theme from and read the relevant documentation, or better yet, perhaps there’s a page on the demo site (assuming there is a demo site) of whatever theme you’re using that shows examples of all the wonderful shortcodes it contains? Otherwise, you’ll need to start looking at bundled shortcode plugins – of which there’s a heap available: some free and some premium, like Styles with Shortcodes for WordPress, Vision and Intense Shortcodes.

*assuming such functionality comes with your theme, you’ll usually find it mentioned/advertised on the site from which you bought it from.

Alternatively, if you fancy coding your own shortcodes, check out the official WordPress Shortcode API Codex for more details.

Still reading? Go spice up your site/s with a few shortcodes already!

By Brin Wilson

Founder of WinningWP - passionate about all things WordPress! Active on both Twitter and Google+ (preferred).
More in Basics
How to create a self-hosted WordPress blog – in 7 simple steps (Infographic)!

If you're new to blogging and want to create a self-hosted WordPress blog but don't know where to start, this recent – and very helpful...

Close