How to Use Shortcodes in WordPress

Need to use a shortcode on your site? In this tutorial, you’ll learn:

  • How to use shortcodes
  • Why they exist
  • Examples of shortcodes in use

How to Use Shortcodes

A shortcode is a method for including special content in a Post or Page.

For example, the Simple Basic Contact Form plugin gives users a shortcode to add a contact form to their site. Here’s what that shortcode looks like:

[simple_contact_form]

To use a shortcode like the one above, simply copy and paste it into the contents of a Post or Page.

If you installed the Simple Basic Contact Form plugin, you would then see a contact page displayed on the front end of the site.

Any plugins that use shortcodes will provide you with a shortcode you can copy and paste.

Why Are Shortcodes Used?

Think about this from the developer’s perspective:

Imagine you made a plugin that lets users create a contact form. Now, you need a way for them to add it to their site. You could force them to publish a special “Contact” page, but what if they want to display other text above/below the form? What if they want to call it something other than “Contact”, or add the form to multiple pages?

The solution is to give users a shortcode to insert the contact form. Shortcodes are extremely flexible and allow you to place content from a plugin, like a contact form, anywhere on your site.

Examples of Shortcodes

To give you an idea of how incredible and useful shortcodes can be, here are a few more examples:

Meta Slider

The Meta Slider plugin lets you create and add beautiful sliders to your site. Every slider has its own shortcode to let you embed it in any post or page on your site.

WP Google Maps

WP Google Maps lets you add highly customized Google Maps embeds to your posts and pages. Once you’ve created a custom map, you’ll get a special shortcode to embed it.

Shortcodes Ultimate

The Shortcodes Ultimate plugin leverages the power of shortcodes to give you access to a wide variety of graphical elements. From buttons to image sliders, there are over 50 different shortcodes packaged into this plugin that you can use to add graphics anywhere in your content.

Conclusion

I hope I’ve shown you the incredible usefulness and ease of using shortcodes on your site. Now instead of being intimidated by them, you can look for them in every plugin you install.

Related Posts

One Comment
  1. very simple and easy tutorial.. thanks

Comments are closed.