Once you’ve made the choice to use WordPress for your website, there are some excellent features that make it easier. You can customize the functionality with plugins that help make styling, adding content, and optimizing your site for SEO (to name just a few) much easier.

There are also a number of shortcodes that can be put into any post, page, or widget on your WordPress website. Shortcodes are a great way to additional functionality to a site without needing any programming knowledge.

What Are WordPress Shortcodes

WordPress shortcodes are little bits of code that let you quickly and easily add bits of predefined functionality to your site. They were introduced with WordPress version 2.5 so that people can add functionality into posts, pages, and widgets without having to write any custom code. The concept is similar to the Macros functionality in Microsoft Office products – a way to reduce repetition in your work and save you time.

Using Shortcodes in WordPressThere are a large number of things that can be done with shortcodes in WordPress. Here are a few examples:

  • Embed a YouTube video into a page
  • Add a Twitter feed into the sidebar of your site
  • Add a styled button to your site
  • Add a list of recent blog posts to the footer of your website
  • Embed music from Spotify
  • Add a styled image gallery into a blog
  • Add a subscription form for people to signup to get notified when you publish a new blog

If there’s some HTML coding that you do regularly on your website that’s long and tedious, you can also write a custom shortcode to save you all that typing over and over. WordPress Developers will often add custom shortcodes into the theme they create for your site to help out with this. That’s more technical so we’re not going to cover that here, but know if you’re repeating code in your site on a regular basis you may want to consider making it into a shortcode.

What Words to Use in a Shortcode

Shortcodes have many, many functionalities programmed into WordPress and WooCommerce. But you need to ensure that you are using the correct word and syntax when using a shortcode. You’ll also need to do a little research to find out if a shortcode actually exists for the functionality that you want to use.

Some shortcodes are pre-programmed into WordPress, or can be added on within your theme or by using plugins. The most popular plugin is Shortcodes Ultimate, which is free and open source and used by over 780,000 people.

The key to using a shortcode is to know the word or phrase and how it is used or laid out. If you have incorrect syntax, the function will not work. Also you need to lookup that a shortcode exists for the functionality that you want to use. For example, a shortcode like [this-website-is-awesome] wouldn’t do anything on your website because no one has programmed functionality to that code. As I mentioned before, if one does not exist and you know your way around writing code in HTML, you may be able to create one that you need on your own, or ask your developer to create one for you.

Shortcode Formatting

Shortcodes on a WordPress website are always enclosed within square brackets, like
[recent-posts]

The simplest version of a shortcode is a single word or phrase enclosed within square brackets.
[gallery]

Shortcodes can also include attributes. The first word in the shortcode is the standard command, and the phrases after it give more details. For example, to embed a video onto your site you need to not only use the [video] command, but also tell the site where to find that video. So the shortcode for adding a video to one of your WordPress pages might look like [video src=”router-configuration-instructions.mp4”]

Common WordPress Shortcodes

[gallery] – Adds an image gallery to your page. You can set the width, size, and number of images within the gallery plugin itself.

[video] – Embeds a video into your page or post and enables it to play from within your website versus opening in a new window to YouTube or the like. Using this shortcode, you can add videos from your computer as well as those on YouTube, Vimeo, Twitch, or from other websites.

[related-posts] – Adds posts that have similar keywords in them into your content. A great way to get users to continue searching on your website, especially on your blog pages. You can see an example of this functionality at the bottom of this blog page.

[link] – Adds a link to another page on your website. When you use this shortcode, instead of including the URL of the page you want to link to, you would instead include the page or post ID number. This is superior to including the URL because over time the URL might change (like if you change your site to https, or rename a menu section), which would then break the link within your page. Using this [link] shortcode ensures that even if the URL changes, the link will still function correctly.

[contact-form] – Embeds your contact form into a page, post, or widget. This is a great way to get users to convert on your pages, and saves them from having to visit another page to reach out to you.

[googlemaps] – Embeds an interactive Google map on your site. A nice feature to include on your contact page, or a locations page if you have multiple offices. You’ll need to get an embed code from Google maps itself to tie your location in here.

[audio] – Allows a user to listen to an audio file that you upload. The shortcode functionality adds the clip to an audio player so they can listen right on your website versus having to download the clip or visit another website.

[blog_subscription_form] – Allows users to sign up to get email updates whenever you publish a new blog article.

[twitter-timeline] – Displays any pubic Twitter feed on your blog. Nice for keeping your users updated on your lasts tweets.

Want to learn how to use WordPress to your advantage? Our team of experts at TheeDesign can help you develop a site that’s easy to use, update, and looks great. Call us at 919-341-8901 or schedule a consultation.