Skip to content

leemcd56/wordpress-comment-walker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

WordPress Comment Walker

A simple comment walker that extends existing WordPress functionality by replacing the html5_comment function in Walker_Comment.

Installation

This walker should work with all WordPress themes, but we recommend to use Sage by Roots if you're building from scratch.

For Sage:

  • Add CommentWalker.php to the /src folder
  • In functions.php, add CommentWalker to the required files array (line 51)

Other themes:

  • Add CommentWalker.php to whatever directory theme functions are placed
  • In functions.php use require_once to add the walker in to runtime

Usage

After adding in, using the comment walker is pretty easy. Wherever a wp_list_comments is located, add 'walker' => new Comment_Walker and set 'format' => 'html5' to utilize it. It should look like the following:

  wp_list_comments([
    'avatar_size' => 50,
    'format' => 'html5',
    'short_ping' => true,
    'style' => 'li',
    'walker' => new Comment_Walker
  ]);

Contributing

Feel free to contribute to this project. The template could certainly be refactored, and I will come back to it as I work on future projects. I will credit every contributor below.

Releases

No releases published

Packages

No packages published