WordPress and Shortcodes: The Short Manual

The WordPress logo with a white background

What is a shortcode?

WordPress comes with many features that makes it easy for users, regardless of skill level, to build or write great pages. Shortcodes, introduced in WordPress 2.5, are an easy way to integrate plugins or other features into your posts and/or pages. For example, plugin authors can create a shortcode for a plugin that displays a graph. As the user, all you need to do is to copy and paste into the post editor. You can even customize the shortcode by adding some text. Most of the time, plugins will come with instructions on what you can change so you can make the feature look just the way you want it to. The greatest thing about shortcodes is that no coding knowledge is required since the markup (structure) is so easy to understand and manipulate.

Let’s learn how to use them in our posts/pages.

How do I use shortcodes?

First, you must be logged into your WordPress Dashboard. Let’s create a new post:

WordPress Dashboard posts

Next, click on the ‘Add New’ button:

Add New Post button

You should now be able to view the Edit Post screen:

The post editor

You can add a title if you wish but let’s add a short and simple shortcode into the content area. Let’s start out by adding a gallery. The following is the gallery shortcode in its simplest form, like so:

The gallery shortcode used

Let’s make our gallery a little more special by adding a size and an ID. (For any developers/designers out there):

gallery post

Try clicking on the Publish button:

gallery in post editor

That’s about it! You should now see the gallery in your post. Look below if you would like to learn more.

Creating Shortcodes

I will cover creating a shortcode, for a plugin, in a future post. For now, you can take a look at the resources listed below to create your own. Take a look at the Shortcode API page for a quick example.

Resources

If you would like to learn more about the Shortcode API, you can read the following links below:

Shorcode – WordPress Codex

Shortcode API – WordPress Codex  (Examples come from this page)

Shortcode Ultimate – WordPress Plugin (Want some practice? Try this plugin out)

If you have any questions or concerns, feel free to leave a comment below. Thank you for reading!

OUR SERVICE

Fan Commerce

ファンコマース

ファンとのダイレクトなコミュニケーションを実現して「感動体験」をビジネスに結びつけます。

Digital Marketing

デジタルマーケティング

未来を創造する価値ある「顧客体験」を実現する仕組みづくりを提案。