Skip to main content

Shortcode is a small piece of code enclosed in square brackets that displays dynamic content or styles content without requiring any HTML.

Shortcodes are widely used across School of Medicine (SOM) websites to add content such as forms, tables, directories, buttons, and stylized content. They make it easy to add complex or styled features while keeping content consistent, accessible, and easy to maintain.

If you edit a page and don’t see the text or images that appear on the live site, that content is likely being pulled in dynamically by shortcode.

How to Identify Shortcode

Shortcodes are easy to spot — they’re always wrapped in brackets [ ]. If you see content on your page like the examples below, you’re looking at shortcode.

  • [button style="btn-primary btn-lg" type="link" target="false" title="Primary" link="#"]
  • [unc_directory]
  • [notification type="alert-info" close="false" ] Your content [/notification]

Often, the beginning of the shortcode name indicates what it does. For example, [button] shortcodes create buttons, [unc_directory] displays a gallery of directory profiles, and [gravityform id="1"] adds a form. The first couple of words are a helpful clue to identify the type of shortcode being used.


Types of Shortcode

There are two main types of shortcode used on SOM websites, shortcode that styles content and shortcode that pulls in content dynamically.

Shortcode That Styles Content

These shortcodes are used to style or format the content that’s already on the page. This content lives directly on the page and is simply surrounded by shortcode to give it a specific look or layout.

Popular examples include:

These and other style related shortcodes are covered in the Styling Content section of the Web Guide, where you can find detailed instructions.


Shortcode That Pulls in Content

Some shortcodes don’t just style content, they also pull in dynamic content from elsewhere on your site. These are often self-closing shortcodes that act as placeholders for content generated by a plugin or content stored in another part of the site, such as directories, forms, or Cells layouts.

In most cases, a plugin creates and manages this dynamic content while the shortcode simply tells WordPress, “display that content here.”

How Plugin Shortcodes Work

  1. You create content within the plugin.
  2. The plugin generates a shortcode.
  3. You place that shortcode on the page where you want the content to appear.
  4. When the page loads, WordPress reads the shortcode and displays the content that it references.

If you need to update what appears on the page, make those edits in the plugin where the content lives, not in the page that displays it. Please refer to the related shortcode documentation for instructions.

Examples

  • Directory shortcode — displays a gallery of faculty profiles. To edit profiles, go to the Directory plugin.
  • Cells plugin shortcode — displays page layouts or design components. Manage the content from the Cells plugin.
  • Gravity Forms shortcode — inserts a form created in the Gravity Forms plugin.

If you delete a shortcode, the displayed content disappears from the page but the source content still exists in the plugin.


Examples and Help Identifying Shortcode

Below are examples of the most common shortcodes used on School of Medicine websites that pull in dynamic content, along with links to their related documentation.

Cells

The Cells plugin provides a wide variety of pre-designed layouts and color options, allowing editors to quickly style and structure page content. Learn more: Cells Plugin Documentation.

  • The shortcode starts with “somcells.”
  • [somcells cell_id=14635]

Directory

There are two directory plugins, each with its own shortcode, that display galleries of faculty and staff profiles. Learn more: Directory Documentation.

New Directory Plugin

  • Shortcode starts with “upd_people_directory.”
  • [upd_people_directory ...]

Old Directory Plugin

  • Shortcode starts with “unc_directory.”
  • [unc_directory ...]

Toolset

Toolset is an advanced plugin used for custom and dynamic content that typically requires assistance from the SOM Web Team. It has a few different types of shortcode – mainly views and content templates. This shortcode likely represents a custom element created by the Web Team. There is no documentation for these shortcodes because each instance is unique. Contact the Web Team if you need help understanding or managing the dynamic content being displayed.

  • Content templates have a shortcode prefix of [wpv-post-body… ]
  • Views have a shortcode prefix of [wpv-view… ]

TablePress

Displays tables created with the TablePress plugin. Learn more: TablePress Documentation.

  • The shortcode starts with “table.”
  • [table id=2 /]

Forms

Embeds forms created with the Gravity Forms plugin. Learn more: Forms Documentation.

  • The shortcode starts with “gravityform.”
  • [gravityform id="2" title="false" description="false"]

News and Events

Shortcode created by UNC ITS offers 3 different display options for both news and events. The naming convention isn’t consistent so these are a little harder to identify. Note that the Cells plugin can also be used to display news and events. Learn more: News and Events Documentation.

News Posts

  • These shortcodes have “posts” or “heels_posts” at the beginning of the shortcode.
  • [heels_posts posts="4" htag="h2"]
  • [heels_list_posts posts="4" htag="h2"]
  • [iso_posts posts="20" htag="h2"]

Events

  • Two of the tree options start with “heels-tribe.”
  • [heels-tribe-events number="4"]
  • [heels-tribe-list number="4"]
  • [iso_posts posts="20" htag="h2"]

Widgets On Pages

Widgets are modular content blocks that can display items such as menus, news feeds, events, or other reusable components. Although widgets are typically placed in designated widget areas (like sidebars or footers), some SOM sites may use a plugin that insert widget content into the body content area.

  • [widgets_on_pages id=””]
  • [do_widget id=""]