Add [!global] render hint to story passwords
This will render the note on all associated chapters if they do not have a more specific note.
This commit is contained in:
parent
024e0a2775
commit
143340a4db
@ -1996,7 +1996,7 @@ function fictioneer_render_story_data_metabox( $post ) {
|
||||
'fictioneer_story_password_note',
|
||||
array(
|
||||
'label' => _x( 'Password Note', 'Story password note meta field label.', 'fictioneer' ),
|
||||
'description' => __( 'Displayed for password protected content. Limited HTML allowed.', 'fictioneer' )
|
||||
'description' => __( 'Displayed for password protected content; start with "[!global]" to show on all protected chapters without note. Limited HTML allowed.', 'fictioneer' )
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -153,6 +153,16 @@ get_header( null, $header_args );
|
||||
|
||||
// Password note
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_chapter_password_note', $post->ID );
|
||||
|
||||
if ( post_password_required() && empty( $password_note ) ) {
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_story_password_note', $story_id );
|
||||
|
||||
if ( ! empty( $password_note ) && strpos( $password_note, '[!global]' ) !== false ) {
|
||||
$password_note = str_replace( '[!global]', '', $password_note );
|
||||
} else {
|
||||
$password_note = '';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<section id="chapter-content" class="chapter__content content-section">
|
||||
|
Loading…
x
Reference in New Issue
Block a user