[WP 101] What Are WordPress Shortcodes And How To Master Them

Carlos Oliveira

In this blog post we talk about what are shortcodes, how to use them and what you can achieve with them.

[WP 101] What Are WordPress Shortcodes And How To Master Them

Shortcodes act as shortcuts to add information or embed data in your website easily. They were introduced back in WordPress 2.5 and are specific to WordPress.

Many plugins make use of shortcodes and you can even create your own, but, by default, WordPress supports these shortcodes:

[audio]

[caption]

[embed]

[gallery]

[playlist]

[video]

To explore in detail what each of them does, read Shortcode « WordPress Codex

Pretty useful, right!

April 2024 Offer – For a Limited Time Only:

Get WordPress 99+ Plugins Mega Bundle for 15% off! Don’t miss out!

Fill the form and receive directly to your mailbox a discount code.

Shortcodes in CreativeMinds’ Plugins

Shortcodes in CreativeMinds’ Plugins - [WP 101] What Are WordPress Shortcodes And How To Master Them

Most of our plugins offer shortcodes in one way or another. For instance, with the Booking Calendar plugin you can add different calendars to any page with them.

The Questions and Answers plugin has shortcodes that display question tables.

Parameters

One feature that makes shortcodes extra powerful is the parameters.

They help making the shortcode more specific and usually come in two types: filtering parameters and view parameters.

Filtering parameters specify what data the shortcode will display. For instance, only videos published by a certain channel.

View parameters specify how the generated content should look like. For instance, they can define if the embedded video player will have full screen option or not.

Do I Have To Memorize Them?

No, not at all! They were designed precisely to make the life of those who don’t code easier.

For that reason, you can always see the full list of shortcodes in two places:

  • The documentation of the plugin (For example, CM Answers (CMA) – Shortcodes – Using Shortcodes)
  • The plugin settings, in the Shortcodes submenu. Clicking the link will direct you to a page listing all the shortcodes and its parameters.
    Shortcode menu plugin back-end - [WP 101] What Are WordPress Shortcodes And How To Master Them

    Shortcode menu in the plugin back-end

Examples

Ok, enough theory! Time for some practical knowledge.

Example 1

For instance, if you are using the Questions and Answers plugin and try this:

[cma-questions]

You will return a list of all questions.

Dashboard showing questions posted by a user in the CM Answers plugin - [WP 101] What Are WordPress Shortcodes And How To Master Them

Dashboard showing questions posted by a user in the CM Answers plugin

Example 3

But what if you want to show only questions related to the category “sports”? You can apply the “cat” parameter, and the end result will be.

[cma-questions cat=”sports”]

Simple, right?

Example 3

Note that sometimes you can list multiple values into a parameter, such as:

[cma-questions cat=”sports, art, cinema”]

This will result in a table with only questions inside the categories sports, art and cinema.

Example 5

Finally, remember that you can (and should!) use multiple parameters. The shortcode below generates a table with questions from the categories sports, art and cinema and also limits the table to five questions at once.

[cma-questions cat=”sports, art, cinema” limit=5]

Extra Tips

Extra Tips - [WP 101] What Are WordPress Shortcodes And How To Master Them

  • Yes/No – Many parameters are about turning on and off a certain feature. When that is the case, usually you will use “0” to turn the feature off and “1” to turn them on.
    For example:
    [cma-questions dateposted=1]

    will display the questions table with the post date of each thread, while

    [cma-questions formontop=0]

    will hide the date.

  • Hidden Parameters Still Count – Remember that some parameters have default values that will be applied even if you don’t write down that parameter inside the shortcode.

Extra Resources

We Accept All Major Credit Cards
Accepted payment methods include all Credit Cards and PayPal