Skip to content

Commit d155ff1

Browse files
committed
better check if it is really a webmention query
1 parent 917585e commit d155ff1

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

includes/class-comment-walker.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,12 @@ public static function comment_query( $query ) {
291291
return;
292292
}
293293

294-
if ( ! empty( $query->query_vars['type__in'] ) ) {
295-
return;
294+
if ( ! empty( $query->query_vars['meta_query'] ) ) {
295+
$query = current( $query->query_vars['meta_query'] );
296+
297+
if ( ! empty( $query['key'] ) && 'protocol' === $query['key'] ) {
298+
return;
299+
}
296300
}
297301

298302
if ( isset( $query->query_vars['count'] ) && true === $query->query_vars['count'] ) {

templates/webmention-comments.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
<?php
22
$mentions = get_comments(
33
array(
4-
'post_id' => get_the_ID(),
5-
'type__in' => get_webmention_comment_type_names(),
6-
'status' => 'approve',
4+
'post_id' => get_the_ID(),
5+
'type__in' => get_webmention_comment_type_names(),
6+
'meta_query' => array(
7+
array(
8+
'key' => 'protocol',
9+
'compare' => 'EXISTS',
10+
),
11+
),
12+
'status' => 'approve',
713
)
814
);
915

1016
$grouped_mentions = separate_comments( $mentions );
11-
$fold_limit = get_option( 'webmention_facepile_fold_limit', 0 );
17+
$fold_limit = get_option( 'webmention_facepile_fold_limit', 0 );
1218

1319
do_action( 'webmention_before_reaction_list' );
1420

@@ -21,10 +27,11 @@
2127
<ul class="reaction-list reaction-list--<?php echo esc_attr( $mention_type ); ?>">
2228
<h2><?php echo get_webmention_comment_type_attr( $mention_type, 'label' ); ?></h2>
2329

24-
<?php if ( ( $fold_limit > 0 ) && $fold_limit < count( $mentions ) ) {
30+
<?php
31+
if ( ( $fold_limit > 0 ) && $fold_limit < count( $mentions ) ) {
2532
$overflow = array_slice( $mentions, $fold_limit );
26-
$show = array_slice( $mentions, 0, $fold_limit );
27-
?>
33+
$show = array_slice( $mentions, 0, $fold_limit );
34+
?>
2835
<details class="webmention-facepile">
2936
<summary>
3037
<?php
@@ -47,13 +54,12 @@
4754
);
4855
?>
4956
</details>
50-
<?php
57+
<?php
5158
} else {
5259
wp_list_comments(
5360
array(
5461
'avatar_only' => true,
5562
'avatar_size' => 64,
56-
5763
),
5864
$mentions
5965
);

0 commit comments

Comments
 (0)