"Element dl is missing a required instance of child element dd." Wordpress

1

Hello, I'm trying to validate a project of mine in W3C Validator.

My page contains a Wordpress gallery, the one you manually create from the Dashboard. The problem is, I do not know why, W3C says it shows this error

  

Element dl is missing a required instance of child element dd.

The structure created by the Wordpress Gallery is this:

<dl class="gallery-item">
    <dt class="gallery-icon landscape">
        <!-- img -->
    </dt>
</dl>

Would anyone know of any way to fix this? Since, I can not edit this code created by the gallery.

If useful, follow the W3C link with page verification.

Link with w3c verification

    
asked by anonymous 13.05.2017 / 04:13

1 answer

1

Gallery code can be created in two ways, HTML5 or not.

When the theme has HTML5 support, the tags created are <figure> , <div> and <figcaption> instead of <dl> , <dt> and <dd> , used in other cases. Both sets represent, respectively, the gallery item, the image element, and the caption.

It turns out that the W3C specification of the dl tag requires that it have both the dt and dd child tags, whereas the figure specification does not have this restriction, it may have any children or none.

That is: You have two ways to resolve this:

  • In order for the gallery to pass the validator out of HTML5 mode you need to insert captions in the images, which will be inserted into the dd tags.

  • The other option is to insert this code into your functions.php so that the markup ad gallery changes.

    add_theme_support( 'html5', array( 'gallery' ) );

  • 15.05.2017 / 13:49