Is there a way of creating an empty attribute for a shortcode?
Example:
function paragraph_shortcode( $atts, $content = null ) {
return '<p class="super-p">' . do_shortcode($content) . '</p>';
}
add_shortcode('paragraph', 'paragraph_shortcode');
User types
[paragraph] something [/paragraph]
and it shows
<p class="super-p"> something </p>
How to add an empty attribute functionality to my first code? So when user types
[paragraph last] something [/paragraph]
It will output:
<p class="super-p last"> something </p>
I believe adding a:
extract( shortcode_atts( array(
'last' => '',
), $atts ) );
is a good start, but how to check if user used the "last" attribute while it doesn't have a value?