Shortcode Usage

Learn how to use AlertsDLX with shortcodes

To use AlertsDLX as a shortcode, you can use the following format:

[alertsdlx alert_group="bootstrap"]Alert Description[/alertsdlx]

Here are the parameters you can use, with examples for each.

unique_id

Add a unique ID around the alerts container. This is useful if you need to style to alert.

[alertsdlx unique_id="my-unique-id" alert_title="this is a title"]Alert Description[/alertsdlx]

alert_group

The type of alert style to use. This can be:

  • bootstrap

  • chakra

  • material

  • shoelace

alert_type

For Bootstrap, alert types can be:

  • primary

  • secondary

  • success

  • danger

  • warning

  • info

  • light

  • dark

  • custom (see custom colors)

For Chakra, alert types can be:

  • success

  • info

  • warning

  • error

  • custom (see custom colors)

For Material, alert types can be:

  • success

  • info

  • warning

  • error

  • custom (see custom colors)

For Shoelace, alert types can be:

  • primary

  • success

  • neutral

  • warning

  • danger

  • custom (see custom colors)

Example shortcode use:

align

Can be:

  • center

  • wide

  • full

  • left

  • right

Example shortcode use:

alert_title

Use this parameter if you'd like to set an alert title.

alert_description

Use this parameter to set the alert description.

You can also place the description within the shortcode.

maximum_width and maximum_width_unit

Set the maximum width for the alert.

Can be any CSS unit. For example:

  • px

  • em

  • %

  • vw

  • vh

The following sets a max width of 500 pixels.

icon

This takes SVG markup if you would like an icon to show. You may need to replace the double quotes with single quotes in order to have it work within the shortcode.

For example:

icon_vertical_alignment

Can be:

  • top

  • centered

Example:

icon_appearance

Can be:

  • default

  • rounded

Example:

base_font_size

In pixels, what should be the base font size of the alert? The size of the text and icons scales to the base font size, particularly on mobile and desktop.

Example:

variant

What variant to use for the alert?

For Bootstrap, variants are:

  • default

  • centered

For Chakra, variants are:

  • subtle

  • solid

  • left-accent

  • top-accent

  • centered

For Material, variants are:

  • default

  • outlined

  • filled

  • centered

For Shoelace, variants are:

  • top-accent

  • left-accent

  • solid

  • centered

Shortcode example:

mode

Choose dark or light mode. Properties can be:

  • dark

  • light

button_text and button_url

If showing a button, what text should go inside the button? In order to print a button, a URL must also be specified.

button_target

This can be 'true' or 'false'. If 'true' the URL will open in a new window.

button_rel_no_follow

This can be 'true' or 'false'. If 'true' the URL will be wrapped in a no-follow attribute.

Custom Colors

If you have an custom alert type for parameter alert_type, you can specify these in the shortcode:

  • color_primary (primarily used for the text color)

  • color_border

  • color_accent (used for the button background color)

  • color_alt (used as a hover color for the button)

  • color_bold (used as an icon color)

  • color_light (primarily used as a background color)

Close Button

You can add a close button to the alert. You'd use the following parameters together:

  • close_button_enabled - Whether to show the close button (true or false)

  • close_button_expiration - Time in seconds to save the close behavior. Set to 0 to never remember any expiration.

Last updated