Add password note to stories

This commit is contained in:
Tetrakern 2023-07-27 20:43:18 +02:00
parent d265a742c4
commit d1001809fb
5 changed files with 31 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -75,6 +75,26 @@
"min": "",
"max": 6,
"elements": ""
},
{
"key": "field_64c1a27b3adcb",
"label": "Password Note",
"name": "fictioneer_story_password_note",
"aria-label": "",
"type": "wysiwyg",
"instructions": "Custom message only shown for password protected content. Make clear why there is a password and maybe how to get it.",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"tabs": "all",
"toolbar": "full",
"media_upload": 0,
"delay": 1
}
],
"location": [
@ -95,5 +115,5 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1676677452
}
"modified": 1690411727
}

View File

@ -43,6 +43,7 @@ get_header( null, $header_args );
$story = fictioneer_get_story_data( $post->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' );
// Flags
$can_checkmarks = get_option( 'fictioneer_enable_checkmarks' );
@ -64,7 +65,12 @@ get_header( null, $header_args );
do_action( 'fictioneer_story_after_header', $hook_args );
?>
<section class="story__summary padding-left padding-right"><?php the_content(); ?></section>
<section class="story__summary padding-left padding-right">
<?php if ( post_password_required() && $password_note ) : ?>
<div class="story__password-note infobox"><?php echo $password_note; ?></div>
<?php endif; ?>
<?php the_content(); ?>
</section>
<?php
// Renders copyright notice, tags, actions, and chapters

View File

@ -145,8 +145,6 @@
}
&__password-note {
margin-bottom: 2rem;
p {
text-indent: 0 !important;
}