2024-04-14 12:47:39 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Template Name: Story Page
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Fictioneer
|
|
|
|
* @since 5.14.0
|
|
|
|
* @see comments.php
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// Setup
|
|
|
|
$post_id = get_the_ID();
|
2024-05-09 23:11:21 +02:00
|
|
|
$story_id = get_post_meta( $post_id, 'fictioneer_template_story_id', true );
|
|
|
|
$story_id = fictioneer_validate_id( $story_id, 'fcn_story' );
|
2024-08-12 02:42:45 +02:00
|
|
|
$cover_position = get_theme_mod( 'story_cover_position', 'top-left-overflow' );
|
2024-05-09 23:11:21 +02:00
|
|
|
$render_story_header = get_post_meta( $post_id, 'fictioneer_template_show_story_header', true );
|
2024-08-17 13:54:49 +02:00
|
|
|
$show_thumbnail = has_post_thumbnail( $story_id ) && ! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true );
|
2024-05-09 23:11:21 +02:00
|
|
|
|
|
|
|
if ( ! $story_id ) {
|
|
|
|
$render_story_header = false;
|
|
|
|
}
|
2024-04-14 12:47:39 +02:00
|
|
|
|
2024-08-12 02:42:45 +02:00
|
|
|
// Wrapper classes
|
|
|
|
$wrapper_classes = [];
|
|
|
|
|
2024-08-17 13:54:49 +02:00
|
|
|
if ( $render_story_header && $cover_position === 'top-left-overflow' && $show_thumbnail ) {
|
2024-08-12 02:42:45 +02:00
|
|
|
$wrapper_classes[] = '_no-padding-top';
|
|
|
|
}
|
|
|
|
|
2024-04-14 12:47:39 +02:00
|
|
|
// Header
|
2024-08-12 01:33:57 +02:00
|
|
|
get_header(
|
|
|
|
null,
|
|
|
|
array(
|
|
|
|
'no_index' => get_post_meta( $story_id, 'fictioneer_story_hidden', true ) ? 1 : 0
|
|
|
|
)
|
|
|
|
);
|
2024-04-14 12:47:39 +02:00
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<main id="main" class="main singular">
|
|
|
|
|
2024-06-14 00:31:31 +02:00
|
|
|
<?php do_action( 'fictioneer_main', 'singular-story' ); ?>
|
2024-04-14 12:47:39 +02:00
|
|
|
|
2024-08-12 02:42:45 +02:00
|
|
|
<div class="main__wrapper <?php echo implode( ' ', $wrapper_classes ); ?>">
|
2024-04-14 12:47:39 +02:00
|
|
|
|
|
|
|
<?php do_action( 'fictioneer_main_wrapper' ); ?>
|
|
|
|
|
|
|
|
<?php while ( have_posts() ) : the_post(); ?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// Setup
|
|
|
|
$title = fictioneer_get_safe_title( $post_id, 'singular-story' );
|
|
|
|
$this_breadcrumb = [ $title, get_the_permalink() ];
|
|
|
|
?>
|
|
|
|
|
2024-08-12 02:42:45 +02:00
|
|
|
<article id="singular-<?php echo $post_id; ?>" class="singular__article">
|
2024-05-09 23:11:21 +02:00
|
|
|
|
|
|
|
<?php
|
|
|
|
// Render story header
|
|
|
|
if ( $render_story_header ) {
|
|
|
|
get_template_part(
|
|
|
|
'partials/_story-header',
|
|
|
|
null,
|
|
|
|
array(
|
|
|
|
'story_data' => fictioneer_get_story_data( $story_id ),
|
|
|
|
'story_id' => $story_id,
|
|
|
|
'context' => 'shortcode'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
?>
|
2024-04-14 12:47:39 +02:00
|
|
|
|
|
|
|
<section class="singular__content content-section"><?php the_content(); ?></section>
|
|
|
|
|
|
|
|
<footer class="singular__footer"><?php do_action( 'fictioneer_singular_footer' ); ?></footer>
|
|
|
|
|
|
|
|
</article>
|
|
|
|
|
|
|
|
<?php do_action( 'fictioneer_before_comments' ); ?>
|
|
|
|
|
|
|
|
<?php if ( comments_open() && ! post_password_required() ) : ?>
|
2024-08-12 02:42:45 +02:00
|
|
|
<section class="singular__comments comment-section">
|
2024-04-14 12:47:39 +02:00
|
|
|
<?php comments_template(); ?>
|
|
|
|
</section>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<?php endwhile; ?>
|
|
|
|
</div>
|
|
|
|
|
2024-09-07 16:57:34 +02:00
|
|
|
<?php do_action( 'fictioneer_main_end', 'singular-story' ); ?>
|
|
|
|
|
2024-04-14 12:47:39 +02:00
|
|
|
</main>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// Footer arguments
|
|
|
|
$footer_args = array(
|
|
|
|
'post_type' => 'page',
|
|
|
|
'post_id' => $post_id,
|
|
|
|
'breadcrumbs' => array(
|
|
|
|
[fcntr( 'frontpage' ), get_home_url()]
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
// Add current breadcrumb
|
|
|
|
$footer_args['breadcrumbs'][] = $this_breadcrumb;
|
|
|
|
|
|
|
|
// Get footer with breadcrumbs
|
|
|
|
get_footer( null, $footer_args );
|
|
|
|
?>
|