forked from roots/sage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomments.php
51 lines (43 loc) · 1.47 KB
/
comments.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Use Bootstrap's media object for listing comments
*
* @link http://getbootstrap.com/components/#media
*/
class Roots_Walker_Comment extends Walker_Comment {
function start_lvl(&$output, $depth = 0, $args = array()) {
$GLOBALS['comment_depth'] = $depth + 1; ?>
<ul <?php comment_class('media list-unstyled comment-' . get_comment_ID()); ?>>
<?php
}
function end_lvl(&$output, $depth = 0, $args = array()) {
$GLOBALS['comment_depth'] = $depth + 1;
echo '</ul>';
}
function start_el(&$output, $comment, $depth = 0, $args = array(), $id = 0) {
$depth++;
$GLOBALS['comment_depth'] = $depth;
$GLOBALS['comment'] = $comment;
if (!empty($args['callback'])) {
call_user_func($args['callback'], $comment, $args, $depth);
return;
}
extract($args, EXTR_SKIP); ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class('media comment-' . get_comment_ID()); ?>>
<?php include(locate_template('templates/comment.php')); ?>
<?php
}
function end_el(&$output, $comment, $depth = 0, $args = array()) {
if (!empty($args['end-callback'])) {
call_user_func($args['end-callback'], $comment, $args, $depth);
return;
}
echo "</div></li>\n";
}
}
function roots_get_avatar($avatar, $type) {
if (!is_object($type)) { return $avatar; }
$avatar = str_replace("class='avatar", "class='avatar pull-left media-object", $avatar);
return $avatar;
}
add_filter('get_avatar', 'roots_get_avatar', 10, 2);