How to Add WordPress Shortcodes to Improve Website Functionality
If you have been using WordPress for quite some time now, it is likely that you have heard of the term WordPress shortcodes. These are texts you see within brackets when editing the HTML area in the backend of your website. You might have seen them somewhere while configuring your WordPress website, but they play an important role in improving the functionality of your site.
WordPress shortcodes give you additional features for your website to make your work a lot easier. To help you understand how it works, we will talk about what it is, why to use it, and how to insert it into your WordPress website.
What Are WordPress Shortcodes?
WordPress shortcodes are chunks of small codes that you can insert to where it is needed to add more functionalities to your website. You do not need to write them because you will only copy them from a source.
A WP shortcode looks like this:
How Do You Access WordPress Shortcodes?
There are two ways you can get these HTML shortcodes: through the Shortcodes Ultimate plugin and inbuilt shortcodes.
If you opt for the plugin, you must install and activate it first. Shortcodes Ultimate provides you with a free pack of WP shortcodes that allows you to insert the following:
- Google Map
- Tabs and boxes
- Macro tables
- Buttons with icons
- Responsive videos
- QR code generator
Activating the plugin prevents you from installing a lot of plugins for the functionalities listed above. The shortcodes you have chosen will remain functioning even if you change your template.
Inbuilt shortcodes are those included in your theme, which you can find in the content editor of your WordPress. The only downside to using inbuilt shortcodes is when you change your theme, shortcodes will stop functioning.
When Do You Use WordPress Shortcodes?
Adding dynamic content such as buttons, galleries, a survey form, macro objects, graphics, and video files to your website is when you need shortcodes. These types of content typically require writing many codes, but shortcodes in WordPress allow you to add it in a simpler way.
In other words, shortcodes can make your life a lot easier when you add features to your website.
When Should You Not Use WordPress Shortcodes?
Certain shortcodes are not necessary if you will add only one feature to a single page or post. But if you will use a specific shortcode for several pages or posts, you might need a plugin for that. This also makes it easy for you to delete the shortcode when you change your theme.
How to Add Shortcodes to WordPress
You can insert WordPress shortcodes in themes, widgets, pages, and posts. To let you know how you can insert a shortcode in any of these WordPress elements, we will give you a tutorial for each.
1. Inserting Shortcodes in a Post
Log in to your website and go to Posts from your Dashboard menu. Choose the post you will edit.
Once you are in the post, click the Text view and insert the shortcode. Click Update to save the changes.
2. Inserting Shortcodes in a Widget
Go to Appearance from your Dashboard menu and select Widgets. Drag and drop the text widget to your Sidebar.
Paste the code in the Text view and click Save.
3. Inserting Shortcodes in a Page
Inserting shortcodes in pages is like adding them to your posts. Go to Pages from your Dashboard menu and select the page you will edit.
Go to the Text view and paste the shortcode. Click Update once done.
4. Inserting Shortcodes in a Theme
When inserting a shortcode in your website’s theme, you need to do it in your PHP file. Go back to Appearance and then select Theme Editor.
At the right side of the page, find Theme Functions (functions.php).
Paste this code at the bottom of the file:
<?php echo do_shortcode(“[your_shortcode]”); ?>
Replace “your_shortcode” with your shortcode. Click Update File to save the changes.
Using WordPress shortcodes can make the process of enhancing your site’s functionality easier and quicker. All you need is the list of shortcodes that serves as your reference when configuring your site.
Once you figure out the right shortcode to use, you can immediately start using them on your pages, widgets, posts, or themes. So, know which added feature you would like to add to your website now and insert a shortcode to achieve superior performance for your WordPress site!