post_password ) ? 'password' : '';
$title = fictioneer_get_safe_title( $post->ID, 'single-chapter' );
$age_rating = get_post_meta( $post->ID, 'fictioneer_chapter_rating', true );
$this_breadcrumb = [ $title, get_the_permalink() ];
$story_id = get_post_meta( $post->ID, 'fictioneer_chapter_story', true );
$story_data = null;
$story_post = null;
if ( $story_id && in_array( get_post_status( $story_id ), ['publish', 'private'] ) ) {
$story_post = empty( $story_id ) ? null : get_post( $story_id );
}
// Story data
if ( $story_post ) {
$story_data = fictioneer_get_story_data( $story_id, false ); // Does not refresh comment count!
$chapter_ids = $story_data['chapter_ids'];
$indexed_chapters = $story_data['indexed_chapter_ids'] ?? $chapter_ids;
if ( empty( $age_rating ) ) {
$age_rating = $story_data['rating'];
}
}
// Chapter navigation
$current_index = array_search( $post->ID, $indexed_chapters );
$prev_index = $current_index - 1;
$next_index = $current_index + 1;
// Arguments for hooks and templates/etc. and includes
$hook_args = array(
'author' => get_userdata( $post->post_author ),
'story_post' => $story_post,
'story_data' => $story_data,
'chapter_id' => $post->ID,
'chapter_title' => $title,
'chapter_password' => $post->post_password,
'chapter_ids' => $chapter_ids,
'indexed_chapter_ids' => $indexed_chapters,
'current_index' => $current_index,
'prev_index' => $prev_index >= 0 ? $prev_index : false,
'next_index' => isset( $indexed_chapters[ $next_index ] ) ? $next_index : false
);
?>
ID, 'fictioneer_chapter_list_title', true );
$bookmark_title = trim( wp_strip_all_tags( $bookmark_title ) );
$bookmark_title = $bookmark_title ?: $title;
$bookmark_thumbnail = get_the_post_thumbnail_url( null, 'snippet' );
$bookmark_image = get_the_post_thumbnail_url( null, 'full' );
// If story is set...
if ( $story_post ) {
$bookmark_story_title = $story_data['title'];
// If chapter has no featured image, look in story...
if ( ! $bookmark_thumbnail ) {
$bookmark_thumbnail = get_the_post_thumbnail_url( $story_id, 'snippet' );
$bookmark_image = get_the_post_thumbnail_url( $story_id, 'full' );
}
}
}
?>
ID );
if ( $story_post && 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 = '';
}
}
?>
' . $password_note . '
';
}
}
echo '';
if ( post_password_required() && get_option( 'fictioneer_show_protected_excerpt' ) ) {
echo '
';
?>
' . fictioneer_get_forced_excerpt( $post->ID, 512 ) . '
'; } the_content(); echo '