Update _chapter_hooks.php

This commit is contained in:
Nabeel Shar 2024-01-04 00:12:38 +05:00 committed by GitHub
parent 56ea29a636
commit 48d4b436ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,6 +110,29 @@ function fictioneer_chapter_foreword( $args ) {
}
add_action( 'fictioneer_chapter_before_header', 'fictioneer_chapter_foreword', 10 );
// =============================================================================
// CHAPTER Announcement
// =============================================================================
/**
* Outputs the HTML for the chapter announcement notice
*
* @since Fictioneer 5.8.5
*/
function fictioneer_chapter_announcement_notice() {
// Get notice
// Get notice
$g_notices = trim( get_option( 'fictioneer_chapter_announcement_notice' ) );
// Show Notice
if ( ! empty( $g_notices ) ) { ?>
<div class="chapter__warning infobox polygon clearfix hideable">
<?php echo force_balance_tags( $g_notices ); ?>
</div>
<?php };
}
add_action( 'fictioneer_chapter_before_header', 'fictioneer_chapter_announcement_notice', 20 );
// =============================================================================
// CHAPTER WARNINGS
// =============================================================================
@ -126,15 +149,7 @@ function fictioneer_chapter_warnings( $args ) {
// Setup
$warning = get_post_meta( $args['chapter_id'], 'fictioneer_chapter_warning', true );
$warning_notes = get_post_meta( $args['chapter_id'], 'fictioneer_chapter_warning_notes', true );
// Get notice
$g_notices = trim( get_option( 'fictioneer_chapter_announcement_notice' ) );
// Show Notice
if ( ! empty( $g_notices ) ) { ?>
<div class="chapter__warning infobox infobox--warning polygon clearfix">
<?php echo force_balance_tags( $g_notices ); ?>
</div>
<?php };
// Abort conditions
if ( ( ! $warning && ! $warning_notes ) || post_password_required() ) {
return '';