• Pat

    (@fortythousandmiles)


    I have encountered a problem which could break the pages layout with a missing </div> tag which should be closing the

    <div class="ShariffSC (...)

    when adding a custom CSS class in the Shariff options.

    I think it is down to the fact that for the opening tag it is checking for

    array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts )

    but for the closing tag it is only checking

    array_key_exists( 'style', $atts )

    so if you have added a custom class but no custom styles, the div is not closed.

    Possible solution (?)
    I don’t know if I’m correct on this one, but changing

    // if we had a style attribute close that too
    if ( array_key_exists( 'style', $atts ) ) $output .= '</div>';

    in line 910/911 to

    // if we had a style attribute close that too
    if ( array_key_exists( 'style', $atts ) || array_key_exists( 'cssclass', $atts ) ) $output .= '</div>';

    solved the problem for me.

The topic ‘Missing closing DIV tag when adding custom CSS class could break layout’ is closed to new replies.