"Element dl is Missing a required instance of Child element dd." Wordpress

Asked

Viewed 55 times

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 through the Dashboard. The problem is, I don’t know why, the W3C says shows this error

Element dl is Missing a required instance of Child element dd.

The structure created by Wordpress Gallery is this:

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

Would anyone know any way to fix it? Since, I have no way to edit this code created by the gallery.

If useful, follow the W3C link with the page check.

Link with w3c check

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 the other cases. Both sets represent, respectively: the gallery item, the image element, and the caption.

It turns out that the W3C specification of the tag dl requires her to have both daughter tags dt and dd, whereas the specification of figure has no such restriction, may have any children or no.

That is to say: you have two ways to solve this:

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

  2. The other option is to insert this code into your functions.php so that the gallery Markup ad is changed.

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

  • Man, I just figured out on my own, a few minutes ago, that putting subtitles would solve it. Anyway, thank you for your explanation, it was very helpful.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.