[wp-trac] [WordPress Trac] #8446: post_class() outputs invalid css
class
WordPress Trac
wp-trac at lists.automattic.com
Mon Dec 1 19:55:30 GMT 2008
#8446: post_class() outputs invalid css class
---------------------+------------------------------------------------------
Reporter: lilyfan | Owner: anonymous
Type: defect | Status: new
Priority: high | Milestone: 2.7
Component: General | Version: 2.7
Severity: blocker | Keywords: class
---------------------+------------------------------------------------------
post_class() function outputs category/tag specific classes using its slug
(introduced at [8641]).
But, allowed characters are different between slug and css class name.
(css class name can use [-_a-zA-Z0-9] and non ascii unicod chars)
A "%" character is allowed for slug, but not for css name.
Therefore, invalid class name will be created.
Eg: A user creates "携帯" category (Japanese word for "mobile"), the
category slug will be "%e6%90%ba%e5%b8%af" and post_class() outputs
'class="post hentry category-%e6%90%ba%e5%b8%af"'.
This is an invalid class name.
Avoid this situation, escaping "%" character with backslash "\":
category-\%e6\%90\%ba\%e5\%b8\%af"
This class name is valid. But this seems dirty.
I suggest using class ID insted of class slug.
--
Ticket URL: <http://trac.wordpress.org/ticket/8446>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list