Add filter for chapter page identity HTML
This commit is contained in:
parent
0164576c93
commit
c967c8db51
13
FILTERS.md
13
FILTERS.md
@ -136,6 +136,19 @@ Filters the intermediate output array in the `_card-chapter.php` partial before
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_chapter_identity', $output, $args )`
|
||||
Filters the intermediate output array in the `_chapter_-header.php` partial before it is imploded and rendered. Contains the HTML for the story link, chapter title (safe), and author meta nodes (see `fictioneer_get_chapter_author_nodes()`). Any of these items may be missing depending on the chapter’s configuration.
|
||||
|
||||
**$output:**
|
||||
* $link (string) – HTML for the story back link. Unsafe.
|
||||
* $title (string) – HTML for the chapter title `<h1>`. Unsafe.
|
||||
* $meta (string) – HTML for the chapter author(s) row. Unsafe.
|
||||
|
||||
**Parameters:**
|
||||
* $args (array) – Array of story and chapter data. See partial.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_chapter_micro_menu', $micro_menu, $args )`
|
||||
Filters the intermediate output array of the chapter micro menu in the `fictioneer_get_chapter_micro_menu( $args )` function before it is imploded and rendered.
|
||||
|
||||
|
@ -29,20 +29,23 @@ $story_visible = $args['story_post'] &&
|
||||
|
||||
?>
|
||||
|
||||
<header class="chapter__headline layout-links">
|
||||
<header class="chapter__headline layout-links"><?php
|
||||
$password_class = empty( $args['chapter_password'] ) ? '' : ' _password';
|
||||
$identity = [];
|
||||
|
||||
<?php if ( $story_visible ) : ?>
|
||||
<a href="<?php the_permalink( $args['story_post']->ID ); ?>"><?php echo $args['story_data']['title']; ?></a>
|
||||
<?php endif; ?>
|
||||
if ( $story_visible ) {
|
||||
$identity['link'] = '<a href="' . get_permalink( $args['story_post']->ID ) . '">' . $args['story_data']['title'] . '</a>';
|
||||
}
|
||||
|
||||
<?php if ( ! get_post_meta( $post->ID, 'fictioneer_chapter_hide_title', true ) ) : ?>
|
||||
<h1 class="chapter__title<?php if ( ! empty( $args['chapter_password'] ) ) echo ' password'; ?>"><?php echo $args['chapter_title']; ?></h1>
|
||||
<em class="chapter__author"><?php
|
||||
printf(
|
||||
if ( ! get_post_meta( $post->ID, 'fictioneer_chapter_hide_title', true ) ) {
|
||||
$identity['title'] = '<h1 class="chapter__title' . $password_class . '">' . $args['chapter_title'] . '</h1>';
|
||||
$identity['meta'] = '<em class="chapter__author">' . sprintf(
|
||||
_x( 'by %s', 'Chapter page: by {Author(s)}', 'fictioneer' ),
|
||||
fictioneer_get_chapter_author_nodes( $args['chapter_id'] )
|
||||
);
|
||||
?></em>
|
||||
<?php endif; ?>
|
||||
) . '</em>';
|
||||
}
|
||||
|
||||
</header>
|
||||
$identity = apply_filters( 'fictioneer_filter_chapter_identity', $identity, $args );
|
||||
|
||||
echo implode( '', $identity );
|
||||
?></header>
|
||||
|
Loading…
x
Reference in New Issue
Block a user