• I have tried to set the date_class to apply multiple classes to the date (to match other pages) but this doesn’t work. For example, I use
    date_class="postdate bg-lightgray headerfont postmeta updated"
    But the class names all get concatenated so the result is
    <div class="postdatebg-lightgrayheaderfontpostmetaupdated">

    I can work around this by creating a new class and copying the attributes but that is not so convenient.

    https://www.ads-software.com/plugins/list-category-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jamesrandom

    (@jamesrandom)

    Having looked at the source, this is because it uses sanitize_html_class() to make sure the class is valid/safe. However, this doesn’t allow spaces. There is an update of this function in progress to allow a wider range of characters. I have posted to the bug tracker suggesting it should also allow spaces.
    https://core.trac.www.ads-software.com/ticket/33924

    Thread Starter jamesrandom

    (@jamesrandom)

    The response to that bug report suggests using esc_attr() instead of sanitize_html_class(). I have modified the code and this works exactly as I need. I don’t know if you want to make the change in your code or not …

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can't set multiple classes’ is closed to new replies.