Add filter for story page identity HTML

This commit is contained in:
Tetrakern 2023-12-28 04:32:24 +01:00
parent 3a7d63f9bd
commit 0164576c93
2 changed files with 22 additions and 7 deletions

View File

@ -1234,6 +1234,19 @@ Filters the intermediate output array of the `fictioneer_get_story_buttons( $arg
---
### `apply_filters( 'fictioneer_filter_story_identity', $output, $story_id, $story )`
Filters the intermediate output array in the `_story-header.php` partial before it is imploded and rendered. Contains the HTML for the story title (safe) and author meta nodes (see `fictioneer_get_story_author_nodes()`).
**$output:**
* $title (string) HTML for the story title `<h1>`.
* $meta (string) HTML for the story author(s) meta row.
**Parameters:**
* $story_id (int) The story ID.
* $story (array) Array with story data from `fictioneer_get_story_data()`.
---
### `apply_filters( 'fictioneer_filter_subscribe_buttons', $buttons, $post_id, $author_id, $feed )`
Filters the intermediate output array of the `fictioneer_get_subscribe_options( $post_id, $author_id, $feed )` function before it is imploded and returned. Normally accounts for Patreon, Ko-Fi, SubscribeStar, [Feedly](https://feedly.com/), and [Inoreader](https://www.inoreader.com/).

View File

@ -60,14 +60,16 @@ if ( ! $thumbnail_shown ) {
<div class="story__taxonomies-space"></div>
<?php endif; ?>
<div class="story__identity">
<h1 class="story__identity-title"><?php echo $story['title']; ?></h1>
<div class="story__identity-meta"><?php
printf(
<div class="story__identity"><?php
$identity = [];
$identity['title'] = '<h1 class="story__identity-title">' . $story['title'] . '</h1>';
$identity['meta'] = '<div class="story__identity-meta">' . sprintf(
_x( 'by %s', 'Story page: by {Author(s)}', 'fictioneer' ),
fictioneer_get_story_author_nodes( $story_id )
);
?></div>
</div>
) . '</div>';
$identity = apply_filters( 'fictioneer_filter_story_identity', $identity, $story_id, $story );
echo implode( '', $identity );
?></div>
</header>