Shortcodes

Shortcodes are special kinds of content that users can attach to certain pages by adding the corresponding tag into the post or page text. Shortcodes can include buttons, alerts, and more advanced things like previews of posts or interactive forms.

Post content with an example shortcode highlighted.
Post content with an example shortcode highlighted.

Shortcodes are usually enclosing, so they include content in between the opening and closing tags of the shortcode. This content can usually include anything WordPress supports – images, formatted text etc. An example of an enclosing shortcode is this:

[button]Enclosing shortcode content[/button]

However, shortcodes can also be self-closing, which means they do not include a closing tag or any content. An example of a self-closing shortcode is this:

[button text="Button content"]

Button shortcode

The button shortcode is used to display an attractive link to content either on your site or elsewhere. It comes in a selection of colour, sizes and shapes.

All possible combinations of the button shortcode.
All possible combinations of the button shortcode.

Example shortcode:

[button url="#" style="grey" size="small" type="square"]Small Button[/button]

Options

  • url: The URL to which the button will link.
  • style: The colour of the button. Possible options include grey, green, light-blue, blue, red, orange, purple and black.
  • size: The size of the button. Possible options include small, medium and large.
  • type: Whether the button will have rounded corners or not. Possible options include square and round.

The content of the shortcode determines what text will be displayed on the button.

Alerts

Alerts bring attention to important messages on your site. They can contain any content

The alerts available in Benevolence.
The alerts available in Benevolence.

Example shortcode:

[alert style="white"]White Alert[/alert]

Options

  • style: The style of the alert shortcode determines it’s colour. Possible options include white, gray, red, yellow, green and blue.
WPlook Themes

Can't find what you're looking for?