Shortcodes

BU Stories includes a shortcode to promote stories within your site’s content, making it easy to surface relevant stories throughout your website.

Utilizing Shortcodes

Use the [bu-stories] shortcode to display a story’s cover page and link to the full story. The shortcode supports multiple stories. For helpful tips on using these shortcodes, see examples below.

Feature one BU story aligned to the right

[bu-stories ids="#" align="right"]

An example of content with a right-aligned BU Story shortcode.

Feature one BU story using a circle template

[bu-stories ids="#" template="shortcode-bu-stories-circle"]

An example of content with a BU Story shortcode using the circle template. Note that by default, shortcodes will be centered if no alignment is specified. Certain layouts will display the Featured Image and title instead of the cover page.

Feature multiple BU stories

[bu-stories max="3"]

Shortcode displaying multiple BU Stories. Note that at certain widths and layouts, the shortcode will pull in the Story’s Featured Image and title instead of the cover page.

Feature two BU stories

[bu-stories max="2"]

Shortcode displaying two BU Stories.

  • max: a maximum # of story posts to show
  • ids: the specific story post ids that the user wants to show
  • type: allows for random story posts to be shown
  • categoriesin: return posts found in at least 1 category, by slug(s), comma separated
  • categoriesand: return posts found in all categories, by slug(s), comma separated
  • template: use a specific template partial to show the shortcode content in (e.g., shortcode-bu-stories-circle)
  • alignment: allows the content to have a style for alignment assigned. Can accept the values: left, center, right

Why isn’t the shortcode displaying an image?

Make sure the story has a Featured Image set. Certain widths and layouts require a Featured Image and won’t display properly without them.

Why is the title that’s displaying different from the cover page?

Ideally, the story’s title should be the same as the Heading on your cover page.

How do I find the story ID?

Edit the page and look in the URL. It will say something like “wp-admin/post.php?post=27423&action=edit” – the bolded numbers are the story ID.