2023-01-21 01:31:34 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Partial: Story Footer
|
|
|
|
*
|
|
|
|
* Rendered in the single-fcn_story.php template below the content section with
|
|
|
|
* chapters, blog posts, and custom pages if any. The last block inside the
|
|
|
|
* <article> block.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Fictioneer
|
2024-01-26 17:45:59 +01:00
|
|
|
* @since 4.7.0
|
2024-05-12 14:16:11 +02:00
|
|
|
* @since 5.17.0 - Turned meta data into filterable array.
|
2023-01-21 01:31:34 +01:00
|
|
|
* @see single-fcn_story.php
|
|
|
|
*
|
2023-08-19 22:22:56 +02:00
|
|
|
* @internal $args['story_data'] Story data from fictioneer_get_story_data().
|
|
|
|
* @internal $args['story_id'] Current story and post ID.
|
2023-01-21 01:31:34 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2023-08-20 20:21:48 +02:00
|
|
|
// No direct access!
|
|
|
|
defined( 'ABSPATH' ) OR exit;
|
|
|
|
|
2024-08-12 02:42:45 +02:00
|
|
|
// Render nothing if password is required
|
2023-01-21 01:31:34 +01:00
|
|
|
if ( post_password_required() ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup
|
|
|
|
$story_id = $args['story_id'];
|
|
|
|
$story = $args['story_data'];
|
2024-05-09 23:42:51 +02:00
|
|
|
$post = get_post( $story_id );
|
2023-11-14 18:35:45 +01:00
|
|
|
$show_log = $story['chapter_count'] > 0 && FICTIONEER_ENABLE_STORY_CHANGELOG && get_option( 'fictioneer_show_story_changelog' );
|
2024-05-12 14:16:11 +02:00
|
|
|
$meta_output = [];
|
|
|
|
|
|
|
|
// Status
|
2024-08-02 22:48:42 +02:00
|
|
|
$meta_output['status'] = '<span class="story__meta-item story__status"><i class="' . $story['icon'] . '"></i> ' . fcntr( $story['status'] ) . '</span>';
|
2024-05-12 14:16:11 +02:00
|
|
|
|
|
|
|
// Date
|
|
|
|
$meta_output['date'] = '<span class="story__meta-item story__date _published" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"><i class="fa-solid fa-clock"></i> <span class="hide-below-480">' . get_the_time( get_option( 'date_format' ), $post ) . '</span><span class="show-below-480">' . get_the_time( FICTIONEER_STORY_FOOTER_B480_DATE, $post ) . '</span></span>';
|
|
|
|
|
|
|
|
// Words
|
|
|
|
$meta_output['words'] = '<span class="story__meta-item story__words" title="' . esc_attr__( 'Total Words', 'fictioneer' ) . '"><i class="fa-solid fa-font"></i> ' . $story['word_count_short'] . '</span>';
|
|
|
|
|
|
|
|
// Rating
|
2024-08-02 22:48:42 +02:00
|
|
|
$meta_output['rating'] = '<span class="story__meta-item story__rating" title="' . esc_attr__( 'Rating', 'fictioneer' ) . '"><i class="fa-solid fa-exclamation-circle"></i> ' . fcntr( $story['rating'] ) . '</span>';
|
2024-05-12 14:16:11 +02:00
|
|
|
|
|
|
|
// Checkmark
|
|
|
|
if ( $story['chapter_count'] > 0 ) {
|
|
|
|
$meta_output['checkmark'] = '<button class="story__meta-item checkmark story__meta-checkmark" data-type="story" data-story-id="' . $story_id . '" data-id="' . $story_id . '" data-status="' . esc_attr( $story['status'] ) . '" role="checkbox" aria-checked="false" aria-label="' . sprintf( esc_attr__( 'Story checkmark for %s.', 'fictioneer' ), $story['title'] ) . '"><i class="fa-solid fa-check"></i></button>';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filter
|
|
|
|
$meta_output = apply_filters( 'fictioneer_filter_story_footer_meta', $meta_output, $args, $post );
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
?>
|
|
|
|
|
2024-08-12 02:42:45 +02:00
|
|
|
<footer class="story__footer">
|
2023-11-08 20:03:19 +01:00
|
|
|
<div class="story__extra">
|
2023-11-14 18:35:45 +01:00
|
|
|
<?php if ( $show_log ) : ?>
|
2023-11-08 20:03:19 +01:00
|
|
|
<label class="story__changelog hide-below-400" for="modal-chapter-changelog-toggle" tabindex="-1">
|
|
|
|
<i class="fa-solid fa-clock-rotate-left"></i>
|
|
|
|
</label>
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
2024-05-12 14:16:11 +02:00
|
|
|
<div class="story__meta"><?php echo implode( '', $meta_output ); ?></div>
|
2023-01-21 01:31:34 +01:00
|
|
|
</footer>
|