Shortcodes

What is a shortcode?

A shortcode is a WordPress shortcut that you can use to format your page without using any complex HTML or CSS.

At the University Library, shortcodes allow regular users to make extensive customizations to pages without the need to contact an IT pro!

The tutorials linked on this page will teach you how to use shortcodes to improve the design of your site.

Shortcode syntax

Shortcodes on our site share a common syntax, that we will present here in pseudocode:

  1. Begin with an opening square bracket:
    [
  2. End with a closing square bracket:
    ]
  3. The first text after the opening square bracket is the name of the code:
    [aShortcode]
  4. Shortcodes can contain attributes and values for those attributes. Attribute values should be in quotation marks:
    [aShortcode anAttribute="anAttributeValue"]
  5. Some shortcodes are paired, placing opening and closing codes around content to be formatted. The closing code will simply be the code name with the prefix ‘end’:
    [aShortcode anAttribute="anAttributeValue"]Some Content[endaShortcode]

Why they’re important

In our former content management system (OpenCMS) all users could make extensive formatting changes and add custom scripts to pages. Unfortunately, sometimes these customizations created problems because the expertise needed for maintenance would leave the department. Other times, the customizations would look great, but violate important accessibility rules. Shortcodes allow you to still make significant customizations to your site without worrying about these issues. Shortcodes are compliant with web standards and maintained by the Web Team. Contact the Web Team or your local pro if you need to do something the shortcodes cannot. They can help you with the customization or suggest other solutions.

.