Latest NewsBlog Detail

Single Post

How to Integrate a 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">
        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">
        // Register Custom Comment Walker

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



Sarker Allex
Sarker Allex

Co-Founder & Director at Prokash IT

Provesh is Co-Founder and Director at Prokash IT. He is responsible for managing, growing open source technologies team and has spearheaded more than 250 projects in Salesforce CRM alone. He provides consulting and advisory to clients looking for services relating to CRM(Customer Relationship Management) and ECM(Enterprise Content Management). In the past, Pratyush has held consulting roles with various global technology leaders, such as Globallogic & HCL in Bangladesh. He holds an Engineering graduate degree from Bangladesh Institute of Technology, Roorkee.