What are WordPress Shortcodes

Shortcodes are a great way to additional functionality to your WordPress website without needing any programming knowledge. Read the article to learn more about adding WordPress shortcodes to your website.

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 WordPress

There 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

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

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 “[ 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=”video-source.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.

– 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.

to your advantage? Our team of experts at TheeDigital 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.