Improve forced excerpts on protected stories and chapters

This commit is contained in:
Tetrakern 2024-04-09 21:04:31 +02:00
parent 3023636cce
commit 6a278c671c
7 changed files with 41 additions and 29 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -165,21 +165,23 @@ get_header( null, $header_args );
}
?>
<section id="chapter-content" class="chapter__content content-section">
<?php if ( post_password_required() ) : ?>
<?php if ( $password_note ) : ?>
<div class="chapter__password-note infobox"><?php echo $password_note; ?></div>
<?php endif; ?>
<?php if ( get_option( 'fictioneer_show_protected_excerpt' ) ) : ?>
<div class="resize-font chapter-formatting chapter-font-color chapter-font-family">
<?php echo fictioneer_get_forced_excerpt( $post->ID, 512 ); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="resize-font chapter-formatting chapter-font-color chapter-font-family">
<?php the_content(); ?>
</div>
</section>
<section id="chapter-content" class="chapter__content content-section"><?php
if ( post_password_required() ) {
if ( $password_note ) {
echo '<div class="chapter__password-note infobox">' . $password_note . '</div>';
}
}
echo '<div class="resize-font chapter-formatting chapter-font-color chapter-font-family">';
if ( post_password_required() && get_option( 'fictioneer_show_protected_excerpt' ) ) {
echo '<p class="chapter__forced-excerpt">' . fictioneer_get_forced_excerpt( $post->ID, 512 ) . '</p>';
}
the_content();
echo '</div>';
?></section>
<?php
// After chapter content; includes the afterword and support box

View File

@ -64,17 +64,19 @@ get_header( null, $header_args );
do_action( 'fictioneer_story_after_header', $hook_args );
?>
<section class="story__summary padding-left padding-right">
<?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; ?>
<?php endif; ?>
<?php the_content(); ?>
</section>
<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( $post->ID, 512 ) . '</p>';
}
}
the_content();
?></section>
<?php
// Renders copyright notice, tags, actions, and chapters

View File

@ -28,6 +28,10 @@
padding-top: var(--layout-spacing-vertical);
}
&__password-note {
margin-bottom: 1.5rem;
}
&__actions {
display: flex;
align-items: center;

View File

@ -198,6 +198,10 @@ body:not(.logged-in) .story__actions :first-child:nth-last-child(3) {
}
}
&__password-note {
margin-bottom: 1.5rem;
}
&__copyright-notice {
color: var(--fg-800);
font-size: var(--fs-xxs);