• I created a custom shortcode with two possible attributes in the array (class, style). When I used the shortcode in a page and only populated one of the attribute fields, the generated markup still included the empty attribute field (see below:

    <div class=”foo” style>sample text</div>

    How can I omit the attr that aren’t used? the generated markup should look like this:

    <div class=”foo”>sample text</div>

    https://wordpress.org/plugins/shortcodes-ultimate/

The topic ‘hide empty attributes in generated html’ is closed to new replies.