Shortcodes are WordPress-specific codes which allow you to easily embed content into your posts or pages. Think of it as a shortcut.
Some beginners, as we recently encountered, could get confused on how to exactly add them. Therefore, I decided to write a short article in order to show you how to do it.
Adding a shortcode to a post or page
Most plugins use shortcodes. You create the content with the plugin, and then use the shortcode that it generates to add that content where you want to.
For my example, I’ll use the well-known plugin, Contact Form 7.
After I’ve created a form and saved it, a shortcode was generated.
Different plugins generate different shortcodes, so they won’t all look like in my example.
I’ve selected the entire shortocode, including the brackets “”, and copied it. Now I’ll go to my desired page and paste it.
I’ve created a simple contact page and pasted the shortcode there.
I pasted the code in the Text editor because I’m usually using that, but you can paste it in the Visual editor too.
Let’s see if my contact form was added to the page.
Yep, the contact form is there. It’s as simple as that.
Shortcodes in widgets
Even though some shortcodes work in widgets, WordPress doesn’t support shortcodes there by default. The good news is that you can enable shortcodes to work in widgets by adding a simple code.
That’s a wrap
Hope you found the post useful and comprehensive.
If you have any thoughts or questions, leave a comment, contact us, or message us on Facebook.
Don’t forget to share the info with your friends too, and also subscribe.