This repository has been archived by the owner on Nov 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
comments.php
145 lines (131 loc) · 10 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/**
* The template for displaying comments
*
* @package rtPanel
*
* @since rtPanel 2.0
*/
global $rtp_post_comments;
if ( post_password_required() ) {
?>
<p class="alert"><?php _e( 'This post is password protected. Enter the password to view comments.', 'rtPanel' ); ?></p><?php
return;
}
if ( have_comments() || ( ( ! is_attachment() && comments_open() ) || ( is_attachment() && $rtp_post_comments[ 'attachment_comments' ] ) ) ) {
?>
<div class="comments-container clearfix"><?php
if ( have_comments() ) {
add_filter( 'get_comments_number', 'rtp_only_comment_count', 11, 2 );
$comments_count_only = get_comments_number();
remove_filter( 'get_comments_number', 'rtp_only_comment_count', 11 );
if ( $comments_count_only ) {
?>
<div class="rtp-comment-count clearfix" id="comments"><?php
$comment_count = sprintf( _n( '<span class="count">%1$s</span> Comment', '<span class="count">%1$s</span> Comments', $comments_count_only, 'rtPanel' ), number_format_i18n( $comments_count_only ) );
if ( ( comments_open() ) || $comments_count_only ) {
?>
<h4 class="rtp-comment-count-container"><?php echo $comment_count; ?></h4><?php
echo ( comments_open() ) ? sprintf( __( '<small class="rtp-thoughts"> Add <a role="link" href="%s" title="Add your comment">your comment</a></small>', 'rtPanel' ), '#respond' ) : '';
}
if ( current_user_can( 'moderate_comments' ) ) {
?>
<h6 class="subheader rtp-manage-comments"><a role="link" href="<?php echo get_admin_url( '', 'edit-comments.php?p=' . get_the_ID() ); ?>"><?php _e( 'Manage Comments', 'rtPanel' ); ?></a></h6><?php
}
?>
</div><!-- .rtp-comment-count -->
<ol class="commentlist"><?php
$args = ( $rtp_post_comments[ 'comment_separate' ] ) ? 'callback=rtp_comment_list&type=comment' : 'callback=rtp_comment_list&type=all';
wp_list_comments( $args );
?>
</ol><!-- .commentlist -->
<?php } ?>
<!-- Comment Pagination -->
<?php
if ( get_previous_comments_link() || get_next_comments_link() ) { ?>
<div class="rtp-comments-pagination">
<div class="alignleft"><?php previous_comments_link( '← ' . __( 'Previous Comments', 'rtPanel' ) ); ?></div>
<div class="alignright"><?php next_comments_link( __( 'Next Comments', 'rtPanel' ) . ' →' ); ?></div>
<div class="clear"></div>
</div><?php
}
}
/* Including Comment form using comment_form() function */
if ( ( ! is_attachment() && comments_open() ) || ( is_attachment() && $rtp_post_comments[ 'attachment_comments' ] ) ) {
if ( $rtp_post_comments[ 'hide_labels' ] ) {
$hide_class = ' hide-labels';
$asterix = ( $req ) ? '*' : '';
$label_author = '';
$author_value = __( 'Name', 'rtPanel' ) . $asterix;
$label_email = '';
$email_value = __( 'Email', 'rtPanel' ) . $asterix;
$label_url = '';
$url_value = __( 'Website', 'rtPanel' );
} else {
$hide_class = '';
$label_author = '<label for="author">' . __( 'Name', 'rtPanel' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' );
$author_value = '';
$label_email = '<label for="email">' . __( 'Email', 'rtPanel' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' );
$email_value = '';
$label_url = '<label for="url">' . __( 'Website', 'rtPanel' ) . '</label> ';
$url_value = '';
}
if ( $rtp_post_comments[ 'comment_textarea' ] && ! is_user_logged_in() ) {
$fields = '';
if ( $rtp_post_comments[ 'compact_form' ] ) {
$comments_after = '<p class="comment-form-author compact-comment-form' . $hide_class . '">' . $label_author . '<input role="textbox" id="author" name="author" type="text"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author' ] ? esc_attr( $commenter[ 'comment_author' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_author_placeholder', $author_value ) . '" size="30" /></p>
<p class="comment-form-email compact-comment-form' . $hide_class . '">' . $label_email . '<input role="textbox" id="email" name="email" type="email"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author_email' ] ? esc_attr( $commenter[ 'comment_author_email' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_email_placeholder', $email_value ) . '" size="30" /></p>
<p class="comment-form-url compact-comment-form' . $hide_class . '">' . $label_url . '<input role="textbox" id="url" name="url" type="url" value="' . ( $commenter[ 'comment_author_url' ] ? esc_attr( $commenter[ 'comment_author_url' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_url_placeholder', $url_value ) . '" size="30" /></p>';
} else {
$comments_after = '<p class="comment-form-author clearfix' . $hide_class . '"><input class="alignleft" id="author" name="author" type="text"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author' ] ? esc_attr( $commenter[ 'comment_author' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_author_placeholder', $author_value ) . '" size="30" />' . $label_author . '</p>
<p class="comment-form-email clearfix' . $hide_class . '"><input class="alignleft" id="email" name="email" type="email"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author_email' ] ? esc_attr( $commenter[ 'comment_author_email' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_email_placeholder', $email_value ) . '" size="30" />' . $label_email . '</p>
<p class="comment-form-url clearfix' . $hide_class . '"><input class="alignleft" id="url" name="url" type="url" value="' . ( $commenter[ 'comment_author_url' ] ? esc_attr( $commenter[ 'comment_author_url' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_url_placeholder', $url_value ) . '" size="30" />' . $label_url . '</p>';
}
} else {
if ( $rtp_post_comments[ 'compact_form' ] ) {
$comments_after = '';
$fields = array(
'author' => '<p class="comment-form-author compact-comment-form' . $hide_class . '">' . $label_author . '<input id="author" name="author" type="text"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author' ] ? esc_attr( $commenter[ 'comment_author' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_author_placeholder', $author_value ) . '" size="30" /></p>',
'email' => '<p class="comment-form-email compact-comment-form' . $hide_class . '">' . $label_email . '<input id="email" name="email" type="email"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author_email' ] ? esc_attr( $commenter[ 'comment_author_email' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_email_placeholder', $email_value ) . '" size="30" /></p>',
'url' => '<p class="comment-form-url compact-comment-form' . $hide_class . '">' . $label_url . '<input id="url" name="url" type="url" value="' . ( $commenter[ 'comment_author_url' ] ? esc_attr( $commenter[ 'comment_author_url' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_url_placeholder', $url_value ) . '" size="30" /></p>',
);
} else {
$comments_after = '';
$fields = array(
'author' => '<p class="comment-form-author clearfix' . $hide_class . '"><input role="textbox" class="alignleft" id="author" name="author" type="text"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author' ] ? esc_attr( $commenter[ 'comment_author' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_author_placeholder', $author_value ) . '" size="30" />' . $label_author . '</p>',
'email' => '<p class="comment-form-email clearfix' . $hide_class . '"><input role="textbox" class="alignleft" id="email" name="email" type="email"' . ( $req ? ' required="required"' : '' ) . ' value="' . ( $commenter[ 'comment_author_email' ] ? esc_attr( $commenter[ 'comment_author_email' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_email_placeholder', $email_value ) . '" size="30" />' . $label_email . '</p>',
'url' => '<p class="comment-form-url clearfix' . $hide_class . '"><input role="textbox" class="alignleft" id="url" name="url" type="url" value="' . ( $commenter[ 'comment_author_url' ] ? esc_attr( $commenter[ 'comment_author_url' ] ) : '' ) . '" placeholder="' . apply_filters( 'rtp_url_placeholder', $url_value ) . '" size="30" />' . $label_url . '</p>',
);
}
}
$comments_before = '<p class="comment-notes">' . __( 'Your email address will not be published.', 'rtPanel' ) . '</p>';
comment_form(
array(
'fields' => apply_filters( 'comment_form_default_fields', $fields ),
'comment_notes_before' => $comments_before,
'comment_notes_after' => $comments_after,
'comment_field' => '<p class="comment-form-comment' . ( ( $rtp_post_comments[ 'comment_textarea' ] ) ? ' rtp-comment-above' : ' rtp-comment-below' ) . '"><textarea role="textbox" aria-multiline="true" id="comment" required="required" placeholder="' . apply_filters( 'rtp_comment_placeholder', __( 'Comment...', 'rtPanel' ) ) . '" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
'title_reply' => '<span class="comment-title">' . __( 'Leave a Comment', 'rtPanel' ) . '</span>',
'title_reply_to' => '<span class="comment-title">' . __( 'Leave a Comment', 'rtPanel' ) . '</span>',
'cancel_reply_link' => __( 'Cancel reply', 'rtPanel' ),
'label_submit' => __( 'Submit', 'rtPanel' ),
)
);
} // if you delete this the sky will fall on your head
/*
* Pingbacks and/or Trackbacks
*/
add_filter( 'get_comments_number', 'pingback_trackback_count', 11, 2 );
if ( $rtp_post_comments[ 'comment_separate' ] && get_comments_number() ) {
?>
<h3 class="rtp-comments-header"><span class="count"><?php echo get_comments_number(); ?></span> <?php ( 1 == get_comments_number() ) ? _e( 'Trackback', 'rtPanel' ) : _e( 'Trackbacks', 'rtPanel' ); ?></h3>
<ol id="trackbacks"><?php
$args = 'callback=rtp_ping_list&type=pings';
wp_list_comments( $args );
?>
</ol><?php
} // End of Pingbacks and/or Trackbacks
remove_filter( 'get_comments_number', 'pingback_trackback_count', 11 );
?>
</div><?php
}