How To Use Shortcodes In WordPress

Shortcodes are one of the most useful yet overlooked features of WordPress. It’s a feature that’s been available on WordPress since version 2.5. Yet most WordPress users don’t even know how to make the most out of shortcodes.

Today we’re going to change that. In this post, we give you a quick overview of WordPress shortcodes and how to use them to customize your website, embed additional content in your blog posts, add unique elements like forms in pages, and do much more.

Let’s get started.

What Is a Shortcode in WordPress?

Just as the name suggests, a shortcode is a shortened version of a longer bit of code or script. It’s like a shortcut that you can insert into a page or a post to embed an element without having to write long code scripts.

shorcode example

Shortcodes are used by WordPress plugins and themes to easily add functions and elements anywhere you want. For example, contact form plugins use shortcodes for each form you create. If you want to add a specific form inside a blog post, all you have to do is copy the shortcode and paste it inside the post. And the form will appear in that exact spot when you publish the blog post.

There are ways to create your own shortcodes and add unique functions as well.

Why Use Them?

The best use of shortcodes is how it allows you to avoid cluttering your posts and pages. Instead of adding long lines of code inside the post editor, all you have to do is copy-paste a short piece of code.

These short pieces of code can help you accomplish many things.

  • Easily Embed Media: You can use shortcodes to easily embed different types of media content in your posts and pages. Like a video hosted on an external server, embed Google Maps, audio files, documents, and much more.
  • Add Useful Elements: Shortcodes are also helpful when adding useful elements inside pages such as forms, CTA buttons, and accordions.
  • Stylize Your Content: Shortcodes will allow you to stylize your pages with animations, icons, and pull quotes as well.
  • Design Unique Pages: Shortcodes can be used to design unique page designs by adding content blocks like image galleries with lightboxes, image sliders, tabs, columns, and more.

How To Use WordPress Shortcodes

There are a lot of shortcodes that already comes built-in with WordPress. Check out this list to find some of the most useful and common shortcodes.

Then use the following methods to insert shortcodes in WordPress.

How To Add Shortcodes in Gutenberg Editor

If you’re using the new Gutenberg block editor, adding shortcodes into posts and pages can be a bit difficult as it involves a few steps.

Mainly because Blocks in Gutenberg editor works quite similarly to shortcodes. And the editor already has blocks for many tasks that otherwise require shortcodes.

how to use shortcode - gutenberg 1

First, click on Add Block button. And search for the Shortcode block.

how to use shortcode - gutenberg 2

Then you can type or paste the shortcode to insert it into the post.

How To Add Shortcodes in Classic Editor

In the Classic editor, using shortcodes is very easy.

how to use shortcode - classic

All you have to do is copy the shortcode and paste it anywhere you want. That’s it!

In addition, you can also add shortcodes in sidebar widgets and basically anywhere on your website.

How To Create Custom Shortcodes

There are two ways to create your own shortcodes.

The easiest way is to install a shortcode plugin like Shortcodes Ultimate, which adds more than 50 shortcodes to WordPress. It’s very easy to use.

shortcodes ultimate

The other way is to write your own shortcodes. This requires PHP knowledge and editing WordPress code.

We don’t recommend writing shortcodes for beginners. If you’re experienced in coding, you can look into WordPress Shortcode API guide to learn how to create custom shortcodes.

Conclusion

There are plenty of ways you can leverage shortcodes to your advantage. Whether you’re a web designer or a blogger, shortcodes can help make your work much simpler.

In addition to plugins, you can also look for premium WordPress themes that come loaded with unique shortcodes to easily manage your website design and its elements.

One Subscription: Everything You Need to Build a Website

Get everything you need to build your next website with one simple subscription. From $16 per month, get unlimited access to nearly 2 million WordPress themes, web templates, fonts, graphics, and photos.

Build Your Next Website