HTML5 <article> for WordPress comments

WordPress natively allows us to wrap comments in <div>’s or <li>’s but not HTML5 <article> elements. If you want to do this, add an ‘end-callback’ param to the wp_list_comments function call and set ‘article’ as the style (in comments.php):

    wp_list_comments(array('callback' => 'twentyten_comment',
                           'style' => 'article',
                           'end-callback' => 'twentyten_comment_end'));

…then in functions.php, add the callback function:

    if(!function_exists('twentyten_comment_end')) :
    /**
     * Allow HTML5 <article> (or anything else) for comment container.
     */
    function twentyten_comment_end($comment, $args, $depth) {

        switch($args['style']) {
            case 'ol':
            case 'ul':
            case '':
                echo "</li>\n";
            break;
            default:
                echo '</' . $args['style'] . ">\n";
        }
    }
    endif;

155 thoughts on “HTML5 <article> for WordPress comments

  1. Well-balanced article on the benefits versus risks of testosterone replacement therapy. – https://careconnectclinic.com/ Statistically significant but modest effect size on blood pressure reduction. Lifestyle modifications should remain first-line therapy. .

  2. Техосмотр 2026: отменили а он всё равно догнал водителей снова пройти техосмотр спб

  3. Многие водители считают что легковым техосмотр больше не нужен но при регистрационных операциях карта осмотра часто обязательна. На станции смотрят тормоза руль свет шины и выхлоп — мелочи иногда закрывают на месте. В Петербурге удобно записаться онлайн и пройти осмотр без очереди. Читать далее: пройти техосмотр

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>