From 0164576c933e76fe31df67532ba1affe46ae805c Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Thu, 28 Dec 2023 04:32:24 +0100 Subject: [PATCH] Add filter for story page identity HTML --- FILTERS.md | 13 +++++++++++++ partials/_story-header.php | 16 +++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/FILTERS.md b/FILTERS.md index 3a17311c..f3a3d8b6 100644 --- a/FILTERS.md +++ b/FILTERS.md @@ -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 `

`. +* $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/). diff --git a/partials/_story-header.php b/partials/_story-header.php index 61496976..79ec0b23 100644 --- a/partials/_story-header.php +++ b/partials/_story-header.php @@ -60,14 +60,16 @@ if ( ! $thumbnail_shown ) {
-
-

-
' . $story['title'] . '

'; + $identity['meta'] = '
' . sprintf( _x( 'by %s', 'Story page: by {Author(s)}', 'fictioneer' ), fictioneer_get_story_author_nodes( $story_id ) - ); - ?>
- + ) . ''; + $identity = apply_filters( 'fictioneer_filter_story_identity', $identity, $story_id, $story ); + + echo implode( '', $identity ); + ?>