WordPress / twentysixteen

Twenty Sixteen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
324 stars 150 forks source link

W3C Validator: The itemprop attribute was specified, but the element is not a property of any item #472

Closed henrywright closed 8 years ago

henrywright commented 8 years ago

itemprop="url" is used in custom logo output. The W3C flags this as a validation error when the itemtype attribute is missing from wrapping markup.

I think something like <body itemscope itemtype="http://schema.org/WebPage"... will resolve the problem. Else the itemprop attribute could be removed from the_custom_logo() output.

I've opened a core ticket #37305

EDIT:

I wrote a filter function which will wrap the logo markup and add an itemtype:

add_filter( 'get_custom_logo', function( $html ) {
    return sprintf(
        '<div itemscope itemtype="%1$s">%2$s</div>',
        esc_url( 'https://schema.org/Brand' ),
        $html
    );
} );

If you add that to functions.php, the validator will pass. I'm happy to submit a PR should you think it's worth adding.

karmatosed commented 8 years ago

I have commented over on that core ticket @henrywright - if this is going to be fixed (that's a point needs to be discussed), I would not want every theme to have to fix this. I'm therefore closing as this should be a core fix if at all.