Don’t know anything about programming? Me neither.

 

For anyone who is non-technical, WordPress shortcode can be a lifesaver when it comes to editing your WordPress template (without the risk of breaking it). You probably have heard of the term ‘shortcode’ from your friends, or stumble upon this term when you are looking for answers on WordPress support forums. Let’s cut to the chase: what is WordPress Shortcode?

 

What is a WordPress Shortcode?

In order to add extra security to the site, users cannot add PHP codes to any posts on WordPress, which prevents users from running codes that may cause their sites to become non-functioning. This, however, also hinders the creation of dynamic content on pages or posts. WordPress shortcode is therefore introduced to overcome this issue.

 

A shortcode is analogous to a macro where a single instruction can expand to do a number of tasks – WordPress.org

 

Shortcodes, literally, are tiny bits of code that allows you to publish dynamic content without needing any programming skills. The form of s shortcode is similar to an HTML tag, but everything goes inside the brackets [ ].

 

Shortcode works this way: when you add a shortcode to a page or post, you are instructing the WordPress to find the macro (the items inside the brackets [ ]) and replace it with dynamic content. It acts as a filter and displays only selected content on a post. Since long, complicated codes are broken down into small pieces, it becomes much easier for non-technical people to embed files or create objects.

 

Tip: Remember, shortcode only works after the page or post is published. You may also need additional plug-ins installed for some specific shortcodes that are not currently supported by your theme or site.

 

 

Some Examples of WordPress Shortcode

Note: all the following shortcodes have to be placed between the square brackets [ ].

 

For adding images, audios or videos, it is often easier to use the Visual Editor in WordPress to create objects. These are some of the built-in shortcodes that come with your WordPress site. The gallery shortcode, for instance, should display all images you imported into your WordPress site via the Add Media button.

 

  • [caption] wraps caption around content for images
  • [gallery] adds one or more image galleries
  • [audio] embeds audio files
  • [video] embeds video files
  • [playlist] displays a collection of audio or video files
  • wraps embedded items and specifies dimensions

 

The current theme that you are using probably already includes a bunch of shortcodes. But for some advanced functions, you will need to understand the basic concepts shortcode to get the job done. Here are the 5 basic shortcodes that I find the most useful:

 

 

Once you get to know the basic WordPress shortcodes, the rest of them are just variations of the fundamentals. From there, modifying your theme and posts should be a piece of cake.

 

If you enjoyed reading this post, I’d be very grateful if you can share it with your friends or connections on Facebook, Twitter, LinkedIn or any other platforms!

 

Comments

comments