Add scheduled chapter note to story pages

This commit is contained in:
Tetrakern 2024-01-18 19:08:12 +01:00
parent 2cb8984e41
commit 0766441ea0
5 changed files with 66 additions and 13 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

@ -109,6 +109,46 @@ $collapse_groups = get_option( 'fictioneer_collapse_groups_by_default' );
</section>
<?php
// ======================================================================================
// ANNOUNCEMENT SECTION
// ======================================================================================
?>
<?php
$scheduled_chapters = get_posts(
array(
'post_type' => 'fcn_chapter',
'post_status' => 'future',
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'ASC',
'update_post_term_cache' => false, // Improve performance
'update_post_meta_cache' => false, // Improve performance
'no_found_rows' => true, // Improve performance
'meta_query' => array(
array(
'key' => 'fictioneer_chapter_story',
'value' => $story_id,
),
)
)
);
?>
<?php if ( ! empty( $scheduled_chapters ) ) : ?>
<section id="scheduled-chapter-note" class="story__scheduled-chapter">
<i class="fa-solid fa-calendar-days"></i>
<span><?php
printf(
_x( 'Next Chapter: %1$s, %2$s', 'Scheduled chapter note with date and time.', 'fictioneer' ),
get_the_date( '', $scheduled_chapters[0] ),
get_the_time( '', $scheduled_chapters[0] )
);
?></span>
</section>
<?php endif; ?>
<?php
// ======================================================================================
// CUSTOM PAGES SECTION

View File

@ -272,8 +272,9 @@ $header_breakpoint: 640px;
}
}
.chapter-group {
margin-top: 24px;
.chapter-group,
&__scheduled-chapter,
&__blog {
margin-left: var(--layout-spacing-horizontal-small);
margin-right: var(--layout-spacing-horizontal-small);
@ -281,6 +282,26 @@ $header_breakpoint: 640px;
margin-left: var(--layout-spacing-horizontal);
margin-right: var(--layout-spacing-horizontal);
}
}
&__scheduled-chapter {
display: flex;
align-items: center;
gap: 12px;
color: var(--fg-800);
font-size: var(--fs-dxs);
font-weight: var(--font-weight-semi-strong);
padding: 0 6px;
margin-bottom: 24px;
:is(i, .icon) {
text-align: center;
min-width: 1em;
}
}
.chapter-group {
margin-top: 24px;
.chapter-group__list-item._folding-toggle {
display: block;
@ -400,14 +421,6 @@ $header_breakpoint: 640px;
}
&__blog {
margin-left: var(--layout-spacing-horizontal-small);
margin-right: var(--layout-spacing-horizontal-small);
@include bp(375px) {
margin-left: var(--layout-spacing-horizontal);
margin-right: var(--layout-spacing-horizontal);
}
&-list {
display: flex;
flex-direction: column;