2023-01-21 01:31:34 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Partial: Story Header
|
|
|
|
*
|
|
|
|
* Rendered in the single-fcn_story.php template right after opening
|
|
|
|
* the <article> block.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Fictioneer
|
2024-01-26 17:45:59 +01:00
|
|
|
* @since 5.0.0
|
2024-06-12 12:30:02 +02:00
|
|
|
* @since 5.20.0 - Added Elementor support.
|
2023-01-21 01:31:34 +01:00
|
|
|
* @see single-fcn_story.php
|
|
|
|
*
|
2023-08-19 22:22:56 +02:00
|
|
|
* @internal $args['story_data'] Story data from fictioneer_get_story_data().
|
|
|
|
* @internal $args['story_id'] Current story and post ID.
|
2024-05-09 22:48:24 +02:00
|
|
|
* @internal $args['context'] Render context. Default null.
|
2023-01-21 01:31:34 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2023-08-20 20:21:48 +02:00
|
|
|
// No direct access!
|
|
|
|
defined( 'ABSPATH' ) OR exit;
|
|
|
|
|
2024-06-12 12:30:02 +02:00
|
|
|
// Elementor?
|
|
|
|
if ( function_exists( 'elementor_theme_do_location' ) && elementor_theme_do_location( 'story_header' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
// Setup
|
|
|
|
$story = $args['story_data'];
|
|
|
|
$story_id = $args['story_id'];
|
2024-05-09 23:42:51 +02:00
|
|
|
$post = get_post( $story_id );
|
2024-08-02 14:19:36 +02:00
|
|
|
$cover_position = get_theme_mod( 'story_cover_position', 'top-left-overflow' );
|
2024-08-02 11:02:37 +02:00
|
|
|
|
2024-05-09 22:48:24 +02:00
|
|
|
$thumbnail_shown = has_post_thumbnail( $story_id ) &&
|
2024-04-12 21:24:03 +02:00
|
|
|
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true ) &&
|
2024-08-02 14:19:36 +02:00
|
|
|
! in_array( $cover_position, ['float-left', 'float-right', 'none'] );
|
2024-08-02 11:02:37 +02:00
|
|
|
|
2023-11-30 16:03:53 +01:00
|
|
|
$tax_shown = ! get_option( 'fictioneer_hide_taxonomies_on_pages' ) &&
|
|
|
|
$story['has_taxonomies'] &&
|
|
|
|
! get_post_meta( $story_id, 'fictioneer_story_no_tags', true );
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
// Story header classes
|
2024-08-02 11:17:06 +02:00
|
|
|
$header_classes = ['story__header'];
|
2023-11-30 16:03:53 +01:00
|
|
|
|
|
|
|
if ( ! $tax_shown ) {
|
|
|
|
$header_classes[] = '_no-tax';
|
|
|
|
}
|
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
if ( ! $thumbnail_shown ) {
|
|
|
|
$header_classes[] = '_no-thumbnail';
|
|
|
|
$header_classes[] = 'padding-top';
|
|
|
|
}
|
|
|
|
|
2024-05-09 22:48:24 +02:00
|
|
|
if ( ( $args['context'] ?? 0 ) !== 'shortcode' ) {
|
|
|
|
$header_classes[] = 'padding-left';
|
|
|
|
$header_classes[] = 'padding-right';
|
|
|
|
}
|
|
|
|
|
2024-08-02 14:19:36 +02:00
|
|
|
if ( $cover_position === 'float-top-left' ) {
|
|
|
|
$header_classes[] = '_float-top-left';
|
|
|
|
$header_classes[] = 'padding-top';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $cover_position === 'float-top-right' ) {
|
|
|
|
$header_classes[] = '_float-top-right';
|
|
|
|
$header_classes[] = 'padding-top';
|
|
|
|
}
|
|
|
|
|
2024-08-02 11:17:06 +02:00
|
|
|
// Filter classes
|
|
|
|
$header_classes = apply_filters( 'fictioneer_filter_story_header_classes', $header_classes, $args );
|
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
?>
|
|
|
|
|
2024-08-02 11:17:06 +02:00
|
|
|
<header class="<?php echo implode( ' ', $header_classes ); ?>">
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
<?php if ( $thumbnail_shown ) echo fictioneer_get_story_page_cover( $story ); ?>
|
|
|
|
|
|
|
|
<?php if ( $tax_shown ) : ?>
|
|
|
|
<div class="story__taxonomies tag-group"><?php
|
2023-11-30 20:36:00 +01:00
|
|
|
echo fictioneer_get_taxonomy_pills(
|
|
|
|
array(
|
|
|
|
'fandoms' => $story['fandoms'],
|
|
|
|
'genres' => $story['genres'],
|
|
|
|
'characters' => $story['characters']
|
2023-11-30 20:53:35 +01:00
|
|
|
),
|
|
|
|
'story_header'
|
2023-11-30 20:36:00 +01:00
|
|
|
);
|
2023-01-21 01:31:34 +01:00
|
|
|
?></div>
|
|
|
|
<div class="story__taxonomies-space"></div>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
2023-12-28 04:32:24 +01:00
|
|
|
<div class="story__identity"><?php
|
|
|
|
$identity = [];
|
|
|
|
$identity['title'] = '<h1 class="story__identity-title">' . $story['title'] . '</h1>';
|
|
|
|
$identity['meta'] = '<div class="story__identity-meta">' . sprintf(
|
2023-06-04 14:02:12 +02:00
|
|
|
_x( 'by %s', 'Story page: by {Author(s)}', 'fictioneer' ),
|
|
|
|
fictioneer_get_story_author_nodes( $story_id )
|
2023-12-28 04:32:24 +01:00
|
|
|
) . '</div>';
|
|
|
|
$identity = apply_filters( 'fictioneer_filter_story_identity', $identity, $story_id, $story );
|
|
|
|
|
|
|
|
echo implode( '', $identity );
|
|
|
|
?></div>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
</header>
|