add shortcodes in WordPress
Do you want to create and use shortcodes in your website?
Shortcode is a shortcut to embed contents on posts and pages effortlessly. It is used mostly for embedding videos, audios, slider and forms with only one line of code.
In this tutorial, we’ll cover how to add shortcodes in WordPress.
What is Shortcode and Why you should use it?
Shortcodes is a specific code that allows you to add dynamic content in your site with ease. They are placed inside brackets. For example: [shortcodes]
When shortcodes are used in posts, the code is replaced with suitable dynamic content. It allows you to add any features in posts, pages and widgets.
Default WordPress Shortcodes
WordPress comes with several built-in shortcodes that you can use to embed content. Here, I have listed a few default WordPress shortcodes for you.
- [ audio ]– embed audio files– embed audio files
- [ caption ]– wrap captions around content
- [ embed ]– wrap embed items and set their maximum dimensions
- [ gallery ]– display gallery of images
- [ playlist ]– show a collection of audio and video files
Aside from default shortcodes, many themes and plugins also provide their own shortcodes that you can use right away. They are used to make site customization easy. You can read the documentation to know all the shortcodes provided by that plugin.
Use Shortcodes in WordPress Posts and Pages
It’s extremely easy to add shortcodes in post and pages without any coding skills required.
- At first, log in to WordPress admin area.
- Navigate to Posts>> All posts.
- Open the targeted post where you want to add shortcodes.
- Click on the plus icon and choose the shortcode block. This will add a shortcode block at the desired location.
- Now, copy-paste the desired shortcode in the field.
- Finally, save the changes.
Add shortcodes in WordPress Widgets
You can also use shortcodes in WordPress widget area. The most beginner-friendly way do so is by embedding shortcodes in text widget field.
- Go to Appearance>>widgets.
- Drag and drop text widget into the required widget area.
- Then, simply copy-paste the shortcode into the text box and enclose it with brackets.
- Save the changes.
Once you have done that, open your website frontend and test how it looks.
Feel free to ask questions regarding the task in the comment section below.
You might also like to read other informative articles: