Make story templates loop independent
This commit is contained in:
parent
bf2b02cdc1
commit
ba878ba4eb
@ -487,8 +487,6 @@ add_action( 'fictioneer_story_after_content', 'fictioneer_story_pages', 42 );
|
||||
*/
|
||||
|
||||
function fictioneer_story_chapters( $args ) {
|
||||
global $post;
|
||||
|
||||
// Abort conditions...
|
||||
if ( post_password_required() ) {
|
||||
return;
|
||||
@ -865,5 +863,3 @@ function fictioneer_story_comments( $args ) {
|
||||
<?php // <--- End HTML
|
||||
}
|
||||
add_action( 'fictioneer_story_after_article', 'fictioneer_story_comments', 10 );
|
||||
|
||||
?>
|
||||
|
@ -32,6 +32,7 @@ if ( post_password_required() ) {
|
||||
// Setup
|
||||
$story_id = $args['story_id'];
|
||||
$story = $args['story_data'];
|
||||
$post = get_post( $story_id );
|
||||
$show_log = $story['chapter_count'] > 0 && FICTIONEER_ENABLE_STORY_CHANGELOG && get_option( 'fictioneer_show_story_changelog' );
|
||||
|
||||
?>
|
||||
|
@ -24,6 +24,7 @@ defined( 'ABSPATH' ) OR exit;
|
||||
// Setup
|
||||
$story = $args['story_data'];
|
||||
$story_id = $args['story_id'];
|
||||
$post = get_post( $story_id );
|
||||
$thumbnail_shown = has_post_thumbnail( $story_id ) &&
|
||||
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true ) &&
|
||||
get_theme_mod( 'story_cover_position', 'top-left-overflow' ) === 'top-left-overflow';
|
||||
|
@ -15,12 +15,14 @@
|
||||
<?php
|
||||
|
||||
// Setup
|
||||
$post_id = $args['post_id'] ?? get_the_ID();
|
||||
$post = get_post( $post_id );
|
||||
$can_checkmarks = get_option( 'fictioneer_enable_checkmarks' );
|
||||
$header_args = array(
|
||||
'type' => 'fcn_story'
|
||||
);
|
||||
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_story_hidden', true ) ) {
|
||||
if ( get_post_meta( $post_id, 'fictioneer_story_hidden', true ) ) {
|
||||
$header_args['no_index'] = true;
|
||||
}
|
||||
|
||||
@ -40,72 +42,68 @@ get_header( null, $header_args );
|
||||
|
||||
<?php do_action( 'fictioneer_main_wrapper' ); ?>
|
||||
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<?php
|
||||
// Setup
|
||||
$story_id = $post->ID;
|
||||
$story = fictioneer_get_story_data( $story_id );
|
||||
$epub_name = sanitize_file_name( strtolower( get_the_title() ) );
|
||||
$this_breadcrumb = [ $story['title'], get_the_permalink() ];
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_story_password_note', $story_id );
|
||||
$cover_position = get_theme_mod( 'story_cover_position', 'top-left-overflow' );
|
||||
|
||||
// Arguments for hooks and templates/etc.
|
||||
$hook_args = array(
|
||||
'story_data' => $story,
|
||||
'story_id' => $story_id
|
||||
);
|
||||
?>
|
||||
|
||||
<article id="post-<?php echo $story_id; ?>" class="story__article" data-id="<?php echo $story_id; ?>" data-age-rating="<?php echo strtolower( $story['rating'] ); ?>">
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$story_id = $post->ID;
|
||||
$story = fictioneer_get_story_data( $story_id );
|
||||
$epub_name = sanitize_file_name( strtolower( get_the_title() ) );
|
||||
$this_breadcrumb = [ $story['title'], get_the_permalink() ];
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_story_password_note', $story_id );
|
||||
$cover_position = get_theme_mod( 'story_cover_position', 'top-left-overflow' );
|
||||
// Render article header
|
||||
get_template_part( 'partials/_story-header', null, $hook_args );
|
||||
|
||||
// Arguments for hooks and templates/etc.
|
||||
$hook_args = array(
|
||||
'story_data' => $story,
|
||||
'story_id' => $story_id
|
||||
);
|
||||
// Hook after header
|
||||
do_action( 'fictioneer_story_after_header', $hook_args );
|
||||
?>
|
||||
|
||||
<article id="post-<?php echo $story_id; ?>" class="story__article" data-id="<?php echo $story_id; ?>" data-age-rating="<?php echo strtolower( $story['rating'] ); ?>">
|
||||
|
||||
<?php
|
||||
// Render article header
|
||||
get_template_part( 'partials/_story-header', null, $hook_args );
|
||||
|
||||
// Hook after header
|
||||
do_action( 'fictioneer_story_after_header', $hook_args );
|
||||
?>
|
||||
|
||||
<section class="story__summary padding-left padding-right"><?php
|
||||
if ( post_password_required() ) {
|
||||
if ( $password_note ) {
|
||||
echo '<div class="story__password-note infobox">' . $password_note . '</div>';
|
||||
}
|
||||
|
||||
if ( get_option( 'fictioneer_show_protected_excerpt' ) ) {
|
||||
echo '<p class="story__forced-excerpt">' . fictioneer_get_forced_excerpt( $story_id, 512 ) . '</p>';
|
||||
}
|
||||
<section class="story__summary padding-left padding-right"><?php
|
||||
if ( post_password_required() ) {
|
||||
if ( $password_note ) {
|
||||
echo '<div class="story__password-note infobox">' . $password_note . '</div>';
|
||||
}
|
||||
|
||||
if (
|
||||
! in_array( $cover_position, ['top-left-overflow', 'hide'] ) &&
|
||||
has_post_thumbnail( $story_id ) &&
|
||||
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true )
|
||||
) {
|
||||
echo fictioneer_get_story_page_cover(
|
||||
$hook_args['story_data'],
|
||||
array( 'classes' => '_in-content _' . $cover_position )
|
||||
);
|
||||
if ( get_option( 'fictioneer_show_protected_excerpt' ) ) {
|
||||
echo '<p class="story__forced-excerpt">' . fictioneer_get_forced_excerpt( $story_id, 512 ) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
the_content();
|
||||
?></section>
|
||||
if (
|
||||
! in_array( $cover_position, ['top-left-overflow', 'hide'] ) &&
|
||||
has_post_thumbnail( $story_id ) &&
|
||||
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true )
|
||||
) {
|
||||
echo fictioneer_get_story_page_cover(
|
||||
$hook_args['story_data'],
|
||||
array( 'classes' => '_in-content _' . $cover_position )
|
||||
);
|
||||
}
|
||||
|
||||
<?php
|
||||
// Renders copyright notice, tags, actions, and chapters
|
||||
do_action( 'fictioneer_story_after_content', $hook_args );
|
||||
the_content();
|
||||
?></section>
|
||||
|
||||
// Render footer partial
|
||||
get_template_part( 'partials/_story-footer', null, $hook_args );
|
||||
?>
|
||||
<?php
|
||||
// Renders copyright notice, tags, actions, and chapters
|
||||
do_action( 'fictioneer_story_after_content', $hook_args );
|
||||
|
||||
</article>
|
||||
// Render footer partial
|
||||
get_template_part( 'partials/_story-footer', null, $hook_args );
|
||||
?>
|
||||
|
||||
<?php do_action( 'fictioneer_story_after_article', $hook_args ); ?>
|
||||
</article>
|
||||
|
||||
<?php endwhile; ?>
|
||||
<?php do_action( 'fictioneer_story_after_article', $hook_args ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user