Anyone using WordPress will come across the word shortcode many times. It can get confusing on what it really means and what’s the purpose of it.
Table of Contents
What are Shortcodes?
Shortcodes in WordPress are small bits of code that let you run code inside your posts, pages, widgets or any section of your website. The code is enclosed within the [ ] brackets. Basically shortcode is a compressed version of bigger code blocks that make your life easier.
Why are Shortcodes used?
If you are a developer then you can simply code something for the functionality you are looking to integrate in your website. But what if you aren’t? This is where WordPress lets you use shortcodes to add the same functionalities without knowing how to code.
Shortcodes can be used for a multitude of reasons such as displaying a video on your page or showing an image gallery in your post or embedding a playlist anywhere on your website.
How to use Shortcodes on your WordPress website
Adding something to your WordPress website can be as easy as inserting the below code.
Shortcodes that you can use by default on your website are:
- video: This shortcode allows you to display a video from its source file in any part of your website.
- audio: This shortcode allows you to add an audio file that can be played on your website.
- embed: The main purpose of the embed shortcode is to allow you to set a maximum width and height to your embedded items.
- caption: Using this shortcode you can add captions around content on your WordPress website.
- playlist: This shortcode allows you to create a playlist of audio or video files.
- gallery: This shortcode lets you display a gallery of the images on your website.
Shortcodes are not just limited to the default options that WordPress provides. Many plugins that you install on your website have their own version of shortcodes through which you can execute the custom code of the plugins.
There are no disadvantages of using shortcodes. They are just custom codes that you can run on your website.
If you are using shortcodes provided by your plugin or theme then they will stop working once you remove that plugin or change your theme.