Is it allowed to add an attribute to a shortcode without giving it a value? something like:
[shortcode attr1="hasvalue" attr2]
The attribute attr1
has a value, which I can easily catch in a function like: function shortcode( $atts ) {...
with $atts['attr1']
.
Can I also catch the other attribute attr2
? Its value doesn't exist, so $atts['attr2']
is undefined/empty. But can I maybe simply detect if this attribute has been written or not?
This would be useful for binary settings, such as a true or false indication, where it is a bit redundant to write true="true"
or something like that.
attr2
, it would also fire true if this term was used within another already present attribute.