About Shortcodes

Shortcodes are a way to drop pre-built components into any page or post without writing HTML. The Marsha theme includes a library of shortcodes, all prefixed with mu_, that cover everything from alerts and buttons to program listings and image teasers.

Basic Usage

A shortcode is written inside square brackets with any parameters included as attributes:

Your message here.
Shortcode
[mu_alert type="green"]Your message here.[/mu_alert]

Some shortcodes are self-closing (no content between tags):

Shortcode
[mu_youtube id="og5EzN2v1wE"]

Others wrap content or nest child shortcodes inside a parent wrapper:

Card One
Body text here.
Card Two
Body text here.
Shortcode
[mu_cards]
[mu_card title="Card One" link="#"]Body text here.[/mu_card]
[mu_card title="Card Two" link="#"]Body text here.[/mu_card]
[/mu_cards]

Parameters

Parameters are passed as key-value pairs inside the opening tag. String values should be wrapped in quotes:

This feature is only available by using the Full Width or Full Width (Hero) template.
Shortcode
[mu_billboard title="Welcome to Marshall" img="https://example.com/image.jpg"]

In the documentation for each shortcode, parameters marked with a green code pill are required. All others are optional.

Wrapper Shortcodes

Several components use a wrapper/item pattern, a parent shortcode that controls the overall layout and a child shortcode repeated for each item. Always open and close both tags:

Shortcode
[mu_feature_row type="image"]
[mu_feature_item title="College of Science" link="/cos/" bg_image="https://example.com/cos.jpg"]
[mu_feature_item title="College of Business" link="/cob/" bg_image="https://example.com/cob.jpg"]
[/mu_feature_row]

A Note on Editing

Shortcodes must be entered in the Text (HTML) editor tab, not the Visual editor. Switching between editors can sometimes add extra line breaks inside shortcode tags which may cause them to break.