fictioneer/partials/_collection-statistics.php

58 lines
2.2 KiB
PHP
Raw Permalink Normal View History

2023-01-21 01:31:34 +01:00
<?php
/**
* Partial: Collection Featured List
*
* Renders a statistics block with the number of published stories and chapters
* as well as word count, comments, and the estimated reading time for all. The
* reading time divisor can be changed under Fictioneer > General (default: 200).
*
* @package WordPress
* @subpackage Fictioneer
* @since 4.7.0
2023-01-21 01:31:34 +01:00
* @see single-fcn_collection.php
*
2023-08-05 20:07:30 +02:00
* @internal $args['collection'] Collection post object.
* @internal $args['collection_id'] The collection post ID.
* @internal $args['title'] Safe collection title.
* @internal $args['current_page'] Number of the current page or 1.
* @internal $args['max_pages'] Total number of pages or 1.
* @internal $args['featured_list'] IDs of featured items in the collection. Already cleaned.
* @internal $args['featured_query'] Paginated query of featured items. Already cleaned.
2023-01-21 01:31:34 +01:00
*/
// No direct access!
defined( 'ABSPATH' ) OR exit;
2023-01-21 01:31:34 +01:00
// Setup
$statistics = fictioneer_get_collection_statistics( $args['collection_id'] );
2023-01-21 01:31:34 +01:00
?>
<section class="collection__statistics spacing-top">
<div class="statistics">
<div class="statistics__inline-stat">
2023-09-16 14:25:26 +02:00
<strong><?php _e( 'Stories', 'fictioneer' ); ?></strong>
<span><?php echo number_format_i18n( $statistics['story_count'] ); ?></span>
2023-01-21 01:31:34 +01:00
</div>
<div class="statistics__inline-stat">
2023-09-16 14:25:26 +02:00
<strong><?php _e( 'Chapters', 'fictioneer' ); ?></strong>
<span><?php echo number_format_i18n( $statistics['chapter_count']); ?></span>
2023-01-21 01:31:34 +01:00
</div>
<div class="statistics__inline-stat">
2024-02-02 19:13:07 +01:00
<strong><?php _ex( 'Words', 'Word count caption in statistics.', 'fictioneer' ); ?></strong>
<span><?php echo fictioneer_shorten_number( $statistics['word_count'] ); ?></span>
2023-01-21 01:31:34 +01:00
</div>
<div class="statistics__inline-stat">
2023-09-16 14:25:26 +02:00
<strong><?php _e( 'Comments', 'fictioneer' ); ?></strong>
2023-01-21 01:31:34 +01:00
<span><?php
echo number_format_i18n( $statistics['comment_count'] );
2023-01-21 01:31:34 +01:00
?></span>
</div>
<div class="statistics__inline-stat">
2023-09-16 14:25:26 +02:00
<strong><?php _e( 'Reading', 'fictioneer' ); ?></strong>
<span><?php echo fictioneer_get_reading_time_nodes( $statistics['word_count'] ); ?></span>
2023-01-21 01:31:34 +01:00
</div>
</div>
</section>