2023-01-21 01:31:34 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Custom Post Type: Story
|
|
|
|
*
|
|
|
|
* Shows the details a single story.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Fictioneer
|
|
|
|
* @since 1.0
|
|
|
|
* @see partials/_story-header.php
|
|
|
|
* @see partials/_story-footer.php
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
|
2023-06-13 11:31:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Header
|
|
|
|
$header_args = array(
|
|
|
|
'type' => 'fcn_story'
|
|
|
|
);
|
|
|
|
|
2023-11-30 16:03:53 +01:00
|
|
|
if ( get_post_meta( get_the_ID(), 'fictioneer_story_hidden', true ) ) {
|
2023-06-13 11:31:44 +02:00
|
|
|
$header_args['no_index'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
get_header( null, $header_args );
|
|
|
|
|
|
|
|
?>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
<main id="main" class="main story">
|
2023-07-30 17:00:40 +02:00
|
|
|
<div class="observer main-observer"></div>
|
2023-01-21 01:31:34 +01:00
|
|
|
<?php do_action( 'fictioneer_main' ); ?>
|
|
|
|
<div class="main__background polygon polygon--main background-texture"></div>
|
|
|
|
<div class="main__wrapper _no-padding">
|
|
|
|
<?php do_action( 'fictioneer_main_wrapper' ); ?>
|
|
|
|
|
|
|
|
<?php while ( have_posts() ) : the_post(); ?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// Setup
|
|
|
|
$story_id = $post->ID;
|
|
|
|
$story = fictioneer_get_story_data( $post->ID );
|
|
|
|
$epub_name = sanitize_file_name( strtolower( get_the_title() ) );
|
2023-12-02 11:58:58 +01:00
|
|
|
$this_breadcrumb = [ $story['title'], get_the_permalink() ];
|
2023-11-30 16:03:53 +01:00
|
|
|
$password_note = fictioneer_get_content_field( 'fictioneer_story_password_note', $post->ID );
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
// Flags
|
|
|
|
$can_checkmarks = get_option( 'fictioneer_enable_checkmarks' );
|
|
|
|
|
|
|
|
// Arguments for hooks and templates/etc.
|
|
|
|
$hook_args = array(
|
|
|
|
'story_data' => $story,
|
|
|
|
'story_id' => $story_id
|
|
|
|
);
|
|
|
|
?>
|
|
|
|
|
2024-02-08 22:08:06 +01:00
|
|
|
<article id="post-<?php the_ID(); ?>" class="story__article <?php if ( ! $can_checkmarks ) echo '_no-checkmarks'; ?>" data-id="<?php the_ID(); ?>" data-age-rating="<?php echo strtolower( $story['rating'] ); ?>">
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
<?php
|
|
|
|
// Render article header
|
|
|
|
get_template_part( 'partials/_story-header', null, $hook_args );
|
|
|
|
|
|
|
|
// Hook after header
|
|
|
|
do_action( 'fictioneer_story_after_header', $hook_args );
|
|
|
|
?>
|
|
|
|
|
2023-07-27 20:43:18 +02:00
|
|
|
<section class="story__summary padding-left padding-right">
|
2024-04-06 17:30:59 +02:00
|
|
|
<?php if ( post_password_required() ) : ?>
|
|
|
|
<?php if ( $password_note ) : ?>
|
|
|
|
<div class="story__password-note infobox"><?php echo $password_note; ?></div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php if ( get_option( 'fictioneer_show_protected_excerpt' ) ) : ?>
|
|
|
|
<?php echo fictioneer_get_forced_excerpt( $post->ID, 512 ); ?>
|
|
|
|
<?php endif; ?>
|
2023-07-27 20:43:18 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php the_content(); ?>
|
|
|
|
</section>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
<?php
|
|
|
|
// Renders copyright notice, tags, actions, and chapters
|
|
|
|
do_action( 'fictioneer_story_after_content', $hook_args );
|
|
|
|
|
|
|
|
// Render footer partial
|
|
|
|
get_template_part( 'partials/_story-footer', null, $hook_args );
|
|
|
|
?>
|
|
|
|
|
|
|
|
</article>
|
|
|
|
|
|
|
|
<?php do_action( 'fictioneer_story_after_article', $hook_args ); ?>
|
|
|
|
|
|
|
|
<?php endwhile; ?>
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// Footer arguments
|
|
|
|
$footer_args = array(
|
|
|
|
'post_type' => 'fcn_story',
|
|
|
|
'post_id' => $story_id,
|
|
|
|
'breadcrumbs' => array(
|
|
|
|
[fcntr( 'frontpage' ), get_home_url()]
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
// Add stories list breadcrumb (if set)
|
2023-08-03 23:51:04 +02:00
|
|
|
$stories_page_id = intval( get_option( 'fictioneer_stories_page', -1 ) ?: -1 );
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2023-08-03 23:51:04 +02:00
|
|
|
if ( $stories_page_id > 0 ) {
|
|
|
|
$stories_page_title = trim( get_the_title( $stories_page_id ) );
|
2023-01-21 01:31:34 +01:00
|
|
|
$stories_page_title = empty( $stories_page_title ) ? __( 'Stories', 'fictioneer' ) : $stories_page_title;
|
|
|
|
|
|
|
|
$footer_args['breadcrumbs'][] = array(
|
|
|
|
$stories_page_title,
|
2023-08-03 23:51:04 +02:00
|
|
|
fictioneer_get_assigned_page_link( 'fictioneer_stories_page' )
|
2023-01-21 01:31:34 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add current breadcrumb
|
|
|
|
$footer_args['breadcrumbs'][] = $this_breadcrumb;
|
|
|
|
|
|
|
|
// Get footer with breadcrumbs
|
|
|
|
get_footer( null, $footer_args );
|
|
|
|
?>
|