Managed WordPress Blog

"How to insert shortcodes in WordPress"

Did you ever see a text within [brackets] in WordPress? Then you have seen a WordPress shortcode. Shortcodes add new features to your content and ease your work. Want to add a video, button or survey without writing code? this article “how to insert shortcodes in WordPress” will show you how.

What are shortcodes?

Did you ever see a text within brackets in WordPress? Then you have seen a short code. Shortcodes in WordPress are a special macro or pseudo-tag that tells WordPress to insert content generated from a plugin.

WordPress introduced this feature in WordPress version 2.5. And look like this:


You can enter the special tags in several places on WordPress. It replaces the content, when a web visitor views its WordPress site.

When to use shortcodes in WordPress?

WordPress has several security checks and filters built in.
To prevent malicious code to come into:

  • WordPress Posts
  • WordPress Pages
  • WordPress Widgets
  • WordPress Themes

So, users cannot write code in such WordPress elements. Yet, WordPress shortcodes allow its users to add “dynamic content” inside WordPress.
Such as:

  • Insert graphics
  • Embed video files
  • Add galleries or responsive slider
  • Create macro objects
  • Create a survey form in WordPress
  • Add buttons

Such dynamic content would normally require you write a bunch of php code or at least javascript, html and css. Shortcodes simplify this process of adding features to a WordPress website. They add HTML and other dynamic markup languages. Into the post, page, widget or comment. Wherever the WordPress user wants them to appear. In one single line.

When Not to use shortcodes in WordPress?

Specific shortcodes are not needed if you only create one feature on a specific post or page. But, if you will use that shortcode in many different posts or pages, you may want to use a plugin to add a shortcode. This will make it easier to style a specific WordPress element. It is also easier to remove if you want to change Themes for example.

How are WordPress shortcodes provided?

You can provide WordPress short codes in several ways:

1. Inbuilt shortcodes

These are short codes included in the chosen WordPress Template under the content editor. Such as: “audio, caption, embed, gallery, and video”. These short code stop functioning, when you change the WordPress template.

TIP: Often WordPress users do not know which short codes are available already. To find out, use the shortcode reference plugin. It provides a detailed list of available short codes in the existing WordPress site.

2. Plugins

Lacking features in your WordPress editor? Then using a plugin is the solution. There are numerous plugins which provide a set of versatile short codes for all kinds of dynamic content. With these plugins you can insert, among others:

  • QR code generator
  • Gallery
  • Sliders
  • Responsive videos
  • Buttons with icons
  • Macro tables
  • Tabs and boxes
  • Audio
  • Google Map

You can also find some great plugins that include multiple modules and shortcodes and thus prevents you having to install a dozen of plugins, such as WordPress shortcodes ultimate.

Shortcode ultimate plugin ukázka

After installation:

  • Login to WordPress Dashboard.
  • Click Insert Shortcode.
  • Chose the short code of your choice.

These short codes remain functioning after changing the WordPress template.

How to insert shortcodes in WordPress?

You can insert shortcodes in WordPress on:

  • WordPress Posts
  • WordPress Pages
  • WordPress Widgets
  • WordPress Themes

Some plugins offer the ability to paste into content through short codes. Putting the short code in the body of the Post or Page will perform its function.

1. Insert Short codes in WordPress Post

To insert shortcodes into a WordPress post:

  • Log in to the WordPress Dashboard with your login details.
  • In the navigation menu, click “Post
  • Click the post you want to edit.
  • Click “Text”.
  • Insert shortcode.
  • Click “Update” to save your changes.

TIP: To use the text of a short code in a WordPress post, avoid using double brackets. Yet, if you want the text of the video shortcode to display rather than the actual video you can add: .

2. Insert shortcode in WordPress Pages

To insert shortcodes in WordPress pages:

If you want to use short codes in places other than content, you need to add a text widget first. Second, insert a shortcode into the WordPress Widgets Sidebar or WordPress Templates:

3. Insert Shortcodes in WordPress Widgets.

To use short codes inside your WordPress Widgets sidebar:

  • Log in to the WordPress Dashboard with your login details.
  • In the navigation menu, click “Pages
  • Click the Page you want to edit.
  • Click “Text
  • Add shortcode.
  • Click “Update” to save your changes.Now you can insert shortcuts into a text widget as well as content.

    TIP: Remember, this feature is not enabled by default in WordPress. If you can not see your shortcode in a widget, then you need to add the above code in your theme’s functions.php file.
  • Insert shortcodes in WordPress Templates (advanced)

    Find a shortcode in WordPress theme Here’s an example of what a shortcode looks like:
    • Log in to the WordPress Dashboard with your login details.
    • Drag and drop a text widget to your sidebar
    • Make a small code modification in the functions.php file.
    • At the end of the file, paste Add_filter (“widget_text”, “do_shortcode”);
    • Add your short code of choice inside it.
    • And Save changes.
      • Open the Theme’s folder. Go to:
      • Open the functions.php file or if the theme has an included folder, inside that folder.
      • Open the files and search for the term add_shortcode.
    • function my_shortcode_function() { $i = ‘Hello World!’; return $i; } add_shortcode(‘my-shortcode’, ‘my_shortcode_function’);

       To create an advanced Macro Table
      • Open the Theme’s folder. Go to:
      • Generate a new HTML-table in the Plugin settings.
      • Assign a unique short code to the table: [supsystic-tables id = 10].
      • Select the post or page, where you want to insert the table.
      • Place the shortcode.
      • Click Save to Save your changes. It is possible to use the shortcode in a non-widget area of your theme as well. Add the following PHP function where you want to display the code:

        Echo do_shortcode (“[select_shortcode]”);

        TIP: In the WordPress editor, the added code in the text box is still displayed. You will not see the Table, but the code that calls up the table, when viewed by the user. Yet, your web visitor will see the graphical table.

Hopefully now you know how to insert shortcodes in WordPress.

Share This