Shortcode: Note boxes

Adding special boxes for notes and alerts can easily be done with these MD helper classes, but if you prefer using a shortcode—here’s how:

Add shortcode to functions.php

Luckily all it takes to make a shortcode like this is one simple function:

function md_child_theme_note_shortcode( $atts, $content = null) {
	return '<div class="note mb-single clear">' . do_shortcode( $content ) . '</div>';

add_shortcode( 'note', 'md_child_theme_note_shortcode' );

With the shortcode installed, you can create note boxes like so:

A simple note with bold text and a link.
[note]A simple note with <b>bold text</b> and <a href="#">a link</a>.[/note]

…or if you want to get advanced and create a “content spotlight” with a popup like the box below:

Easy in-post offers with MD:

Signup now

Here’s the code for your post editor using MD helper classes. Note, if using a popup, you need to add the unique ID to the shortcode to make it work. If you want a regular button, replace the popup shortcode with a button link.

<div class="small-title alignleft mt-half mb-half">Easy in-post offers with MD:</div>
[md_popup id="mdemaillist" load="true" type="button" text="Signup now" classes="alignright mb-none"]

Leave a Comment