WordPress Weekend: The Power of WordPress Shortcodes

WordPress Weekend: The Power of WordPress Shortcodes

Shortcodes are one of the best developments in recent WordPress history. When I started blogging back in the late 90s, they didn’t exist. If you wanted code, you wrote the HTML yourself (uphill, in the snow, both ways… heh).

Shortcodes are little bits of code within square brackets you can pop right into the content box in a WordPress post, page, or sidebar widget. They were introduced into WordPress with version 2.5 (as of this writing, we’re on 3.5.1). They usually don’t involve much effort at all on your part. They are useful for an incredible range of content elements you may wish to display in WordPress.

Here is an example of a shortcode that will display a contact form if you have the Contact Form 7 plugin:

shortcode

An example of a shortcode. Note the square brackets, and that some information needs to be wrapped with quotes.

You may be wondering if you have shortcodes available to you, and if so, what would you use them for?

If you have the Jetpack plugins installed in your WordPress, then you have access to its shortcodes. Both plugins and themes can have shortcodes which you can use. You just type them in or copy and paste. Shortcodes do not have to go in the “Text” tab when writing a post. Put them right in the “Visual” tab.

Shortcode Plugins

It’s better to have shortcodes come from plugins instead of themes, so that you can change themes without wrecking your website. Shortcodes that come from plugins will be unaffected and will still work no matter what theme you choose (at least, that’s the case with themes and plugins that are properly coded, anyway).

Here are some shortcode plugins for you to consider and try out;

Jshortcodes examples

Examples of Jshortcodes. Click image to enlarge.

I have not tried any of these myself. The usual warnings apply: make sure you have recently backed up your site before installing new plugins. Consider testing these out on a test blog.

New Content Formatting Options

Probably the biggest advantage shortcodes give you is the content and formatting options. They make it possible for you to create buttons, floating boxes, and even multiple-column content without needing to know or write any HTML, CSS, or JavaScript code.

You kids have it so easy, nowadays! :)

Are you currently using any shortcode plugins? If so, which ones and why?

  • http://twitter.com/KateNasser Kate Nasser

    Hi Michael,

    Thanks for the techie bits. Helpful! Many of us have learned WordPress on the fly and your post gives us wings.

    Question: Do your or your colleagues know anything about SEO by Yoast? I think there is a bug in it specifically “Focus Keyword doesn’t appear in your opening paragraph”…. when it clearly does.

    Any insight on this is greatly appreciated.

    Thanks again,
    Kate N.

    • http://remarkablogger.com Michael Martine

      Glad you liked it! I don’t know anything about bugs in Yoast SEO. The man to ask would be Joost de Valk, its developer. :)

  • Joe Helms

    I 2nd the idea that using shortcodes from themes can be risky. My first theme I ever tried was a free one from Woo Themes – it was nice, and I loved a couple of the shortcodes (one was for quotes in the middle of a post, for example)

    I was new and didn’t realize it was for the theme and not just a feature of WP, so when I changed themes it took me a couple weeks to notice some of my articles weren’t looking like I expected anymore!

    • http://remarkablogger.com Michael Martine

      Yes, that’s why it’s better to use shortcodes from plugins instead of themes. :)

  • http://twitter.com/write_clever Sue Neal

    Hi Michael – this is very interesting, but I’m not sure I’m brave enough to play. I suspect I have some shortcodes in my current theme, so thanks for the tip about that – something to bear in mind if and when I decide to change it. I’m very limited when it comes to coding, I’m afraid and much the same with my blog as I am with my car – I don’t like messing about under the hood.

    Thanks for explaining what a shortcode is, though – at least I know what it means now! I envy you guys who are fluent in html – would love to learn it but just don’t have the time.

    • http://remarkablogger.com Michael Martine

      You don’t need to know HTML to use shortcodes, that’s the whole point. I guess I didn’t explain myself as well as I wanted. :)

    • http://hotsaucedaily.com Brian Meagher

      Sue – they are plugins, you use at your disposal. A really easy way to make custom formatting pieces within your blog at very little risk. Try the free J shortcodes to see what you can do.

  • http://hotsaucedaily.com Brian Meagher

    I appreciate this post, and will be trying some of the plugins… starting with the free J Shortcodes, and possibly the Visions version. Again, thanks Michael!

    • http://remarkablogger.com Michael Martine

      Brian, you’re welcome. My pleasure. Have fun!

  • http://remarkablogger.com Michael Martine

    JJ, thanks for sharing that. It’s not for everyone, but I can see how some folks would want it and be able to get it running. :)

  • Pingback: Shortcodes WordPress, la simplicité et la puissance du code

Headway ad
Headway