Skip to content

A custom WordPress comment walker class to implement the Bootstrap 3 Media object in wordpress comment list.

Notifications You must be signed in to change notification settings

wp-bootstrap/wp-bootstrap-comment-walker

Repository files navigation

wp-bootstrap-comment-walker

A custom WordPress comment walker class to implement the Bootstrap 3 Media object in wordpress comment list.

Installation and Usage

If you haven't already add the HTML5 theme support for comment list, add this first in your functions.php

function custom_theme_setup() {
    add_theme_support( 'html5', array( 'comment-list' ) );
}
add_action( 'after_setup_theme', 'custom_theme_setup' );

Place class-wp-bootstrap-comment-walker.php in your WordPress theme folder /wp-content/your-theme/

Open your WordPress themes comments.php file /wp-content/your-theme/comments.php and in this file you should see a snippet like this:

<ol class="comment-list">
    <?php
        wp_list_comments( array(
            'style'       => 'ol',
            'short_ping'  => true,
            'avatar_size' => 56,
        ) );
    ?>
</ol><!-- .comment-list -->

The above snippet copied from the comments.php of twentyfifteen theme. Now replace the similar code in your comments.php with this following code:

<ul class="list-unstyled">
    <?php
        // Register Custom Comment Walker
        require_once('class-wp-bootstrap-comment-walker.php');

        wp_list_comments( array(
            'style'         => 'ul',
            'short_ping'    => true,
            'avatar_size'   => '64',
            'walker'        => new Bootstrap_Comment_Walker(),
        ) );
    ?>
</ul><!-- .comment-list -->

About

A custom WordPress comment walker class to implement the Bootstrap 3 Media object in wordpress comment list.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published