go41

Fix for rel=”category tag” – Bad value category tag for HTML5 themes

von Joern am 25. Dez. 2011 | Keine Kommentare

Using more HTML5 themes with WordPress I found that the W3C doesn’t validate all HTML5 output of WordPress.

The error I am talking of is:
Bad value category tag for attribute rel on element a: Keyword category is not registered.
WordPress adds to the category list of each post: rel="category tag"

The HTML5 Conformance Checker however would like to see only rel="tag"
The solution is to filter "<?php the_category(‚, ‚); ?>" (the list of categories generated)
most themes have already a functions.php to add or modify functions of WordPress.
Best for me seems to be to add a filter into this file, which replaces rel="category tag" with rel="tag"
The lines to add to functions.php:
function remove_rel_category( $text ) { // w3c error for Bad value category tag for attribute rel
$text = str_replace(‚rel="category tag"‘, ‚rel="tag"‘, $text);
return $text;
}
add_filter( ‚the_category‘, ‚remove_rel_category‘ );
____________________
you find me on Google+, Twitter and Facebook

(von: Joern)

Sorry, no posts matched your criteria.

Autor:

Du findest mich auch auf Google+, Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


weitere forum Beiträge: