Add fictioneer_filter_comment_actions filter
This commit is contained in:
parent
609e631e92
commit
00265f4db3
11
FILTERS.md
11
FILTERS.md
@ -389,6 +389,17 @@ Filters the queried comments in the `comments.php` template and `fictioneer_ajax
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_comment_actions', $output, $comment, $args, $depth )`
|
||||
Filters the intermediate output array of comment actions before it is imploded and rendered. The `$args` parameter also includes the keys `'has_private_ancestor'` (bool), `'has_closed_ancestor'` (bool), and `'sticky'` (bool).
|
||||
|
||||
**Parameters:**
|
||||
* $output (array) - HTML snippets of actions. Normally just `'reply'` (if allowed). Can be empty.
|
||||
* $comment (WP_Comment) – The comment object.
|
||||
* $args (array) – Arguments passed to `fictioneer_theme_comment()` plus extension.
|
||||
* $depth (int) – Depth of the comment.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_comment_badge', $output, $user, $args )`
|
||||
Filters the HTML of the `fictioneer_get_comment_badge( $user, $comment, $post_author_id )` function before it is returned for rendering. The badge class and label are inserted into `<div class="fictioneer-comment__badge CLASS"><span>LABEL</span></div>`. Possible label classes are `is-author`, `is-admin`, `is-moderator`, `is-supporter`, and `badge-override`.
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -665,22 +665,44 @@ if ( ! function_exists( 'fictioneer_theme_comment' ) ) {
|
||||
// (PRIVATE) REPLY BUTTON
|
||||
// =============================================================================
|
||||
?>
|
||||
<?php if ( $can_comment && ! $is_offensive && ! ( $is_report_hidden && ! $is_ignoring_reports ) ) : ?>
|
||||
<?php if ( ! ( $is_report_hidden && ! $is_ignoring_reports ) ) : ?>
|
||||
<div class="fictioneer-comment__actions"><?php
|
||||
$caption = $comment->comment_type === 'private' || $is_child_of_private ? __( 'Private Reply', 'fictioneer' ) : __( 'Reply', 'fictioneer' );
|
||||
$actions = [];
|
||||
|
||||
comment_reply_link(
|
||||
if ( ! $is_offensive && $can_comment ) {
|
||||
$caption = $comment->comment_type === 'private' || $is_child_of_private ?
|
||||
__( 'Private Reply', 'fictioneer' ) : __( 'Reply', 'fictioneer' );
|
||||
|
||||
$actions['reply'] = get_comment_reply_link(
|
||||
array_merge(
|
||||
$args,
|
||||
array(
|
||||
'reply_text' => '<i class="fa-solid fa-reply"></i> ' . $caption,
|
||||
'add_below' => 'div-comment', // Important for position of reply form
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth']
|
||||
)
|
||||
),
|
||||
$comment
|
||||
);
|
||||
}
|
||||
|
||||
$actions = apply_filters(
|
||||
'fictioneer_filter_comment_actions',
|
||||
$actions,
|
||||
$comment,
|
||||
array_merge(
|
||||
$args,
|
||||
array(
|
||||
'reply_text' => '<i class="fa-solid fa-reply"></i> ' . $caption,
|
||||
'add_below' => 'div-comment', // Important for position of reply form
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth']
|
||||
'has_private_ancestor' => $is_child_of_private,
|
||||
'has_closed_ancestor' => $closed_ancestor,
|
||||
'sticky' => $is_sticky
|
||||
)
|
||||
),
|
||||
$comment
|
||||
$depth
|
||||
);
|
||||
|
||||
echo implode( '', $actions );
|
||||
?></div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
|
@ -636,6 +636,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
&__fingerprint {
|
||||
cursor: help;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user