If you’ve been using WordPress or are thinking about using it as the platform for your site, you’ve probably heard some of the jargon associated with it, or read it online somewhere as you’ve done your research. One of the terms you’ll come across is ‘Shortcode.’
A shortcode is essentially a shortcut, and when applied to the code used to build websites, it’s a short version of a sometimes quite lengthy script. In programming, a script is a program or sequence of instructions that is interpreted or carried out by another program rather than by the computer processor. With regard to WordPress this scripting tells WordPress to do a particular thing, for example, “embed this YouTube video in this position before this text on this page”.
The task of embedding the video might require a sequence of steps to be done in order to achieve the end result, which might take quite some time and expertise. But if there is a shortcode for the string of steps, all you need to do is insert the shortcode before the text, and your video can be inserted.
Now I’ve simplified that quite a bit and there is more involved, but in essence that’s what shortcodes do. They act as groupers of code to make displaying your website content easier.
Let me give you another example from my foodie background. When you make a cake, you have two options for achieving the end result, well actually you have three. The first one is to make the cake from scratch, measuring out the ingredients according to the recipe, mixing them in a specific sequence to achieve the chemical and/or physical reactions, and then baking it. Or, you could buy a packet cake in a box, add the egg, water and butter and achieve the same result, often a better result, because it’s been tested hundreds of times and providing you follow the instructions on the packet, it’s hard to go wrong. Or, you could just go to the patisserie and buy a cake already made.
In web development it’s the same. You can write the code to achieve a specific function in your website (same as making a cake from scratch), use a shortcode (a packet cake), or hire a programmer to do it all for you (go to the patisserie).
With more and more people taking their web development into their own hands and using platforms like WordPress, the shortcode has become the packet cake of web development, making WordPress the Betty Crocker of the web.
For the uninitiated, WordPress generally requires plugins to enable much of its functionality. A plugin is a collection of shortcodes, that when installed, enables the WordPress site to perform specific actions. For example, if you wanted to put a Facebook Like Box in your WordPress sidebar but didn’t know how to set up an App within Facebook, nor wanted to, you can install a Facebook Like Box plugin within minutes, add your Facebook page URL (web address) and copy the code it provides in the sidebar where you want to display it. All this is done in minutes instead of hours or days, if you had to wait for an App to be approved by Facebook, but that’s a story for another article.
You can also get plugins that are just a bunch of shortcodes to execute a whole host of functions from creating buttons that link, feeding posts into pages, adding horizontal fancy lines, bordering images and the list goes on. Or you can use a theme (website visual layout template) that has built in shortcodes specifically written for the WordPress platform.
It’s rare now days to not use shortcodes when working with WordPress, and just about every plugin employs them either natively or for manual insertion where you want the functionality to occur. What’s also great, is that shortcodes can be used within shortcodes, let me explain again using the cake example. Let’s say you wanted to make a Chocolate Custard Torte but you didn’t know how to make the cake or the custard. You could buy the packet cake and the packet custard, make both up and use the custard to layer between the slices of cake, giving you the tort. You’ve essentially used the shortcode for custard inside the shortcode of the cake.
Now let’s see how this would work on a web page. Let’s say you had three testimonials and you wanted to feed them all on a page horizontally across the page side by side, and evenly spaced.
First you’ll need evenly spaced positions for the text to display. This can be achieved by first using a column shortcode to divide up the page then adding a testimonial shortcode where the content would go in the column shortcode.
You can add several shortcodes within shortcodes to achieve great functionality in your site. All it takes is imagination of what you’d like and a bit of trial and error to see what will work.
For newbie web developers or web owners wanting to take a greater role in their website management, shortcodes are quite literally the icing on the cake that will make you and your website look like a pro.
When searching for themes and plugins, look through the descriptions and documentation to see how many shortcodes are provided. The more flexibility you have with shortcodes, the more control you will have over what your website can do and how your content will be displayed.
Also look at the some of the shortcode specific plugins that integrate into your editor providing you with quick access on every page or post to some of the most popular shortcodes. Many of the Shortcode Plugins can replace dozens of other plugins that might only handle one function.
Always remember, when searching for and installing plugins, check that they have been updated recently, are compatible with the WordPress version you have installed and have good ratings. The number of downloads is also a good indication as to their quality and reliability. Never install a plugin that has not been updated in the last 6 months.
To find some shortcode plugins, do a search inside your plugin section of the site and try a few to see which suit you best and or don’t conflict with other plugins you have installed. The most popular are usually the ones at the top.