2023-01-21 01:31:34 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Partial: Chapter Header
|
|
|
|
*
|
|
|
|
* Rendered in the single-fcn_chapter.php template below the top actions
|
|
|
|
* and after the fictioneer_chapter_before_header hook.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Fictioneer
|
2024-01-26 17:45:59 +01:00
|
|
|
* @since 5.0.0
|
2023-01-21 01:31:34 +01:00
|
|
|
* @see single-fcn_chapter.php
|
|
|
|
*
|
2023-08-17 16:39:31 +02:00
|
|
|
* @internal $args['story_post'] Optional. Post object of the story.
|
|
|
|
* @internal $args['story_data'] Optional. Story data from fictioneer_get_story_data().
|
|
|
|
* @internal $args['chapter_id'] The chapter ID.
|
|
|
|
* @internal $args['chapter_title'] Safe chapter title.
|
|
|
|
* @internal $args['chapter_password'] Chapter password or empty string.
|
2023-01-21 01:31:34 +01:00
|
|
|
*/
|
|
|
|
?>
|
|
|
|
|
2023-08-17 16:39:31 +02:00
|
|
|
<?php
|
|
|
|
|
2023-08-20 20:21:48 +02:00
|
|
|
// No direct access!
|
|
|
|
defined( 'ABSPATH' ) OR exit;
|
|
|
|
|
2023-08-17 16:39:31 +02:00
|
|
|
$story_visible = $args['story_post'] &&
|
|
|
|
! empty( $args['story_data']['title'] ) &&
|
2023-08-31 17:30:24 +02:00
|
|
|
in_array( get_post_status( $args['story_post']->ID ), ['publish', 'private'] );
|
2023-08-17 16:39:31 +02:00
|
|
|
|
|
|
|
?>
|
|
|
|
|
2023-12-28 17:14:07 +01:00
|
|
|
<header class="chapter__headline layout-links"><?php
|
|
|
|
$password_class = empty( $args['chapter_password'] ) ? '' : ' _password';
|
|
|
|
$identity = [];
|
2023-08-17 16:39:31 +02:00
|
|
|
|
2023-12-28 17:14:07 +01:00
|
|
|
if ( $story_visible ) {
|
2024-04-14 03:25:44 +02:00
|
|
|
$identity['link'] = '<a href="' . get_permalink( $args['story_post']->ID ) . '" class="chapter__story-link">' . $args['story_data']['title'] . '</a>';
|
2023-12-28 17:14:07 +01:00
|
|
|
}
|
2023-08-17 16:39:31 +02:00
|
|
|
|
2023-12-28 17:14:07 +01:00
|
|
|
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(
|
2023-06-04 14:02:12 +02:00
|
|
|
_x( 'by %s', 'Chapter page: by {Author(s)}', 'fictioneer' ),
|
|
|
|
fictioneer_get_chapter_author_nodes( $args['chapter_id'] )
|
2023-12-28 17:14:07 +01:00
|
|
|
) . '</em>';
|
|
|
|
}
|
2023-08-17 16:39:31 +02:00
|
|
|
|
2023-12-28 17:14:07 +01:00
|
|
|
$identity = apply_filters( 'fictioneer_filter_chapter_identity', $identity, $args );
|
|
|
|
|
|
|
|
echo implode( '', $identity );
|
|
|
|
?></header>
|