项目作者: leemcd56

项目描述 :
Just a simple, beautiful comment walker
高级语言: PHP
项目地址: git://github.com/leemcd56/wordpress-comment-walker.git
创建时间: 2017-02-07T22:36:50Z
项目社区:https://github.com/leemcd56/wordpress-comment-walker

开源协议:

下载


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:

  1. wp_list_comments([
  2. 'avatar_size' => 50,
  3. 'format' => 'html5',
  4. 'short_ping' => true,
  5. 'style' => 'li',
  6. 'walker' => new Comment_Walker
  7. ]);

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.