Add fictioneer_filter_story_header_classes

This commit is contained in:
Tetrakern 2024-08-02 11:17:06 +02:00
parent fa106b6046
commit 61eb108d06
2 changed files with 18 additions and 2 deletions

View File

@ -1453,6 +1453,19 @@ Filters the intermediate output array of the `fictioneer_get_story_buttons( $arg
---
### `apply_filters( 'fictioneer_filter_story_header_classes', $classes, $args )`
Filters the intermediate output array of CSS classes for the story header before it is imploded and rendered. Depending on the Customizer and story settings, it can include `story__header`, `_no-tax`, `_no-thumbnail`, `padding-top`, `padding-left`, and `padding-right`.
**$classes:**
* (array) Collection of strings depending on the Customizer and story settings; can include `story__header`, `_no-tax`, `_no-thumbnail`, `padding-top`, `padding-left`, and `padding-right`.
**$args:**
* $story_data (array) Collection of story data.
* $story_id (int) Current story (post) ID.
* $context (string|null) Either `null` or `'shortcode'`. Default `null`. Unsafe.
---
### `apply_filters( 'fictioneer_filter_media_buttons', $output, $args )`
Filters the intermediate output array of the `fictioneer_filter_media_buttons( $args )` function before it is imploded and returned. Used in chapter, posts, and stories.

View File

@ -39,7 +39,7 @@ $tax_shown = ! get_option( 'fictioneer_hide_taxonomies_on_pages' ) &&
! get_post_meta( $story_id, 'fictioneer_story_no_tags', true );
// Story header classes
$header_classes = [];
$header_classes = ['story__header'];
if ( ! $tax_shown ) {
$header_classes[] = '_no-tax';
@ -55,9 +55,12 @@ if ( ( $args['context'] ?? 0 ) !== 'shortcode' ) {
$header_classes[] = 'padding-right';
}
// Filter classes
$header_classes = apply_filters( 'fictioneer_filter_story_header_classes', $header_classes, $args );
?>
<header class="story__header <?php echo implode( ' ', $header_classes ); ?>">
<header class="<?php echo implode( ' ', $header_classes ); ?>">
<?php if ( $thumbnail_shown ) echo fictioneer_get_story_page_cover( $story ); ?>