forked from godaddy-wordpress/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pluggable.php
86 lines (81 loc) · 2.8 KB
/
pluggable.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* WP Theme pluggable functions
*
* @package Go
*/
if ( ! function_exists( 'go_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own go_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @param string $comment Comment text.
* @param array $args Array of arguments.
* @param int $depth Depth of comments to show.
*/
function go_comment( $comment, $args, $depth ) {
switch ( $comment->comment_type ) :
case 'pingback':
case 'trackback':
// Display trackbacks differently than normal comments.
?>
<li <?php comment_class(); ?> id="comment-<?php esc_attr( comment_ID() ); ?>">
<p><?php esc_html_e( 'Pingback:', 'go' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'go' ), '<span class="edit-link">', '</span>' ); ?></p>
<?php
break;
default:
// Proceed with normal comments.
global $post;
?>
<li <?php comment_class(); ?> id="li-comment-<?php esc_attr( comment_ID() ); ?>">
<article id="comment-<?php esc_attr( comment_ID() ); ?>" class="comment">
<header class="comment-meta comment-author vcard">
<?php
echo get_avatar( $comment, 44 );
printf(
'<cite><b class="fn">%1$s</b> %2$s</cite>',
get_comment_author_link(),
// If current post author is also comment author, make it known visually.
( $comment->user_id === $post->post_author ) ? '<span>' . esc_html__( 'Post author', 'go' ) . '</span>' : ''
);
printf(
'<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
esc_html( get_comment_time( 'c' ) ),
/* translators: 1: date, 2: time */
sprintf( esc_html__( '%1$s at %2$s', 'go' ), esc_html( get_comment_date() ), esc_html( get_comment_time() ) )
);
?>
</header><!-- .comment-meta -->
<?php if ( '0' === $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php esc_html__( 'Your comment is awaiting moderation.', 'go' ); ?></p>
<?php endif; ?>
<section class="comment-content comment">
<?php comment_text(); ?>
<?php edit_comment_link( __( 'Edit', 'go' ), '<p class="edit-link">', '</p>' ); ?>
</section><!-- .comment-content -->
<div class="reply">
<?php
comment_reply_link(
array_merge(
$args,
[
'reply_text' => __( 'Reply', 'go' ),
'after' => ' <span>↓</span>',
'depth' => $depth,
'max_depth' => $args['max_depth'],
]
)
);
?>
</div><!-- .reply -->
</article><!-- #comment-## -->
<?php
break;
endswitch; // end comment_type check.
}
endif;