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 ) {
|
function fictioneer_story_chapters( $args ) {
|
||||||
global $post;
|
|
||||||
|
|
||||||
// Abort conditions...
|
// Abort conditions...
|
||||||
if ( post_password_required() ) {
|
if ( post_password_required() ) {
|
||||||
return;
|
return;
|
||||||
@ -865,5 +863,3 @@ function fictioneer_story_comments( $args ) {
|
|||||||
<?php // <--- End HTML
|
<?php // <--- End HTML
|
||||||
}
|
}
|
||||||
add_action( 'fictioneer_story_after_article', 'fictioneer_story_comments', 10 );
|
add_action( 'fictioneer_story_after_article', 'fictioneer_story_comments', 10 );
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -32,6 +32,7 @@ if ( post_password_required() ) {
|
|||||||
// Setup
|
// Setup
|
||||||
$story_id = $args['story_id'];
|
$story_id = $args['story_id'];
|
||||||
$story = $args['story_data'];
|
$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' );
|
$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
|
// Setup
|
||||||
$story = $args['story_data'];
|
$story = $args['story_data'];
|
||||||
$story_id = $args['story_id'];
|
$story_id = $args['story_id'];
|
||||||
|
$post = get_post( $story_id );
|
||||||
$thumbnail_shown = has_post_thumbnail( $story_id ) &&
|
$thumbnail_shown = has_post_thumbnail( $story_id ) &&
|
||||||
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true ) &&
|
! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true ) &&
|
||||||
get_theme_mod( 'story_cover_position', 'top-left-overflow' ) === 'top-left-overflow';
|
get_theme_mod( 'story_cover_position', 'top-left-overflow' ) === 'top-left-overflow';
|
||||||
|
@ -15,12 +15,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
|
$post_id = $args['post_id'] ?? get_the_ID();
|
||||||
|
$post = get_post( $post_id );
|
||||||
$can_checkmarks = get_option( 'fictioneer_enable_checkmarks' );
|
$can_checkmarks = get_option( 'fictioneer_enable_checkmarks' );
|
||||||
$header_args = array(
|
$header_args = array(
|
||||||
'type' => 'fcn_story'
|
'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;
|
$header_args['no_index'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,72 +42,68 @@ get_header( null, $header_args );
|
|||||||
|
|
||||||
<?php do_action( 'fictioneer_main_wrapper' ); ?>
|
<?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
|
<?php
|
||||||
// Setup
|
// Render article header
|
||||||
$story_id = $post->ID;
|
get_template_part( 'partials/_story-header', null, $hook_args );
|
||||||
$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 after header
|
||||||
$hook_args = array(
|
do_action( 'fictioneer_story_after_header', $hook_args );
|
||||||
'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'] ); ?>">
|
<section class="story__summary padding-left padding-right"><?php
|
||||||
|
if ( post_password_required() ) {
|
||||||
<?php
|
if ( $password_note ) {
|
||||||
// Render article header
|
echo '<div class="story__password-note infobox">' . $password_note . '</div>';
|
||||||
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>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if ( get_option( 'fictioneer_show_protected_excerpt' ) ) {
|
||||||
! in_array( $cover_position, ['top-left-overflow', 'hide'] ) &&
|
echo '<p class="story__forced-excerpt">' . fictioneer_get_forced_excerpt( $story_id, 512 ) . '</p>';
|
||||||
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 )
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
the_content();
|
if (
|
||||||
?></section>
|
! 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
|
the_content();
|
||||||
// Renders copyright notice, tags, actions, and chapters
|
?></section>
|
||||||
do_action( 'fictioneer_story_after_content', $hook_args );
|
|
||||||
|
|
||||||
// Render footer partial
|
<?php
|
||||||
get_template_part( 'partials/_story-footer', null, $hook_args );
|
// 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>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user