2023-01-21 01:31:34 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Partial: Latest Updates (+ Simple)
|
|
|
|
*
|
|
|
|
* Renders the (buffered) HTML for the [fictioneer_latest_updates] or
|
|
|
|
* [fictioneer_latest_updates type="simple"] shortcodes. Looks for the
|
|
|
|
* 'fictioneer_chapters_added' meta property and only updates when the
|
|
|
|
* items in the chapters list increase. Admittedly, this can be exploited
|
|
|
|
* by removing and re-adding chapters.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Fictioneer
|
2024-01-26 17:45:59 +01:00
|
|
|
* @since 4.3.0
|
2023-01-21 01:31:34 +01:00
|
|
|
*
|
2024-08-21 22:53:24 +02:00
|
|
|
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
|
|
|
|
* @internal $args['single'] Whether to show only one chapter item. Default false.
|
|
|
|
* @internal $args['count'] Number of posts provided by the shortcode.
|
|
|
|
* @internal $args['author'] Author provided by the shortcode.
|
|
|
|
* @internal $args['order'] Order of posts. Default 'DESC'.
|
|
|
|
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
|
|
|
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
|
|
|
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
|
|
|
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
|
|
|
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
|
|
|
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
|
|
|
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
|
|
|
* @internal $args['relation'] Relationship between taxonomies.
|
|
|
|
* @internal $args['source'] Whether to show author and story.
|
|
|
|
* @internal $args['vertical'] Whether to show the vertical variant.
|
|
|
|
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
|
|
|
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
|
|
|
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
|
|
|
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
|
|
|
* @internal $args['words'] Whether to show the word count of chapter items. Default true.
|
|
|
|
* @internal $args['date'] Whether to show the date of chapter items. Default true.
|
|
|
|
* @internal $args['terms'] Either inline, pills, none, or false. Default inline.
|
|
|
|
* @internal $args['max_terms'] Maximum number of taxonomies terms. Default 10.
|
|
|
|
* @internal $args['date_format'] String to override the date format. Default empty.
|
|
|
|
* @internal $args['nested_date_format'] String to override the date format of nested items. Default empty.
|
|
|
|
* @internal $args['footer'] Whether to show the footer. Default true.
|
|
|
|
* @internal $args['footer_chapters'] Whether to show the story chapter count. Default true.
|
|
|
|
* @internal $args['footer_words'] Whether to show the story word count. Default true.
|
|
|
|
* @internal $args['footer_date'] Whether to show the modified date. Default true.
|
|
|
|
* @internal $args['footer_status'] Whether to show the story status. Default true.
|
|
|
|
* @internal $args['footer_rating'] Whether to show the story age rating. Default true.
|
|
|
|
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
2023-01-21 01:31:34 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2023-08-20 20:21:48 +02:00
|
|
|
// No direct access!
|
|
|
|
defined( 'ABSPATH' ) OR exit;
|
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
// Setup
|
|
|
|
$card_counter = 0;
|
2024-08-21 22:53:24 +02:00
|
|
|
$show_terms = ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) &&
|
|
|
|
! in_array( $args['type'], ['simple', 'single'] ) &&
|
|
|
|
! in_array( $args['terms'], ['none', 'false'] );
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
// Prepare query
|
|
|
|
$query_args = array(
|
2023-09-15 14:00:44 +02:00
|
|
|
'fictioneer_query_name' => 'latest_updates',
|
2023-03-09 02:03:09 +01:00
|
|
|
'post_type' => 'fcn_story',
|
|
|
|
'post_status' => 'publish',
|
2023-08-17 01:32:02 +02:00
|
|
|
'post__in' => $args['post_ids'], // May be empty!
|
2023-09-16 13:25:38 +02:00
|
|
|
'order' => $args['order'],
|
2023-01-21 01:31:34 +01:00
|
|
|
'orderby' => 'meta_value',
|
2023-09-16 13:25:38 +02:00
|
|
|
'meta_key' => 'fictioneer_chapters_added',
|
2023-09-16 22:59:43 +02:00
|
|
|
'posts_per_page' => $args['count'] + 4, // Account for non-eligible posts!
|
2024-08-21 22:53:24 +02:00
|
|
|
'update_post_term_cache' => $show_terms, // Improve performance
|
2024-01-29 23:38:21 +01:00
|
|
|
'no_found_rows' => true // Improve performance
|
2024-01-28 18:59:23 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// Use extended meta query?
|
2024-01-28 19:55:54 +01:00
|
|
|
if ( get_option( 'fictioneer_disable_extended_story_list_meta_queries' ) ) {
|
2024-01-29 23:38:21 +01:00
|
|
|
// Extended syntax necessary due to 'fictioneer_chapters_added'
|
|
|
|
$query_args['meta_query'] = array(
|
|
|
|
array(
|
|
|
|
'key' => 'fictioneer_story_hidden',
|
|
|
|
'value' => '0'
|
|
|
|
)
|
|
|
|
);
|
2024-01-28 18:59:23 +01:00
|
|
|
} else {
|
|
|
|
$query_args['meta_query'] = array(
|
2024-01-28 19:55:54 +01:00
|
|
|
'relation' => 'OR',
|
2024-01-28 18:59:23 +01:00
|
|
|
array(
|
|
|
|
'key' => 'fictioneer_story_hidden',
|
|
|
|
'value' => '0'
|
2024-01-28 19:55:54 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'key' => 'fictioneer_story_hidden',
|
|
|
|
'compare' => 'NOT EXISTS'
|
2024-01-28 18:59:23 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2023-09-16 13:25:38 +02:00
|
|
|
// Author?
|
2023-09-17 01:28:14 +02:00
|
|
|
if ( ! empty( $args['author'] ) ) {
|
2023-09-16 13:25:38 +02:00
|
|
|
$query_args['author_name'] = $args['author'];
|
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2023-09-16 22:59:43 +02:00
|
|
|
// Author IDs?
|
|
|
|
if ( ! empty( $args['author_ids'] ) ) {
|
|
|
|
$query_args['author__in'] = $args['author_ids'];
|
|
|
|
}
|
|
|
|
|
2023-03-08 23:24:41 +01:00
|
|
|
// Taxonomies?
|
|
|
|
if ( ! empty( $args['taxonomies'] ) ) {
|
|
|
|
$query_args['tax_query'] = fictioneer_get_shortcode_tax_query( $args );
|
|
|
|
}
|
|
|
|
|
2023-03-10 17:09:46 +01:00
|
|
|
// Excluded tags?
|
|
|
|
if ( ! empty( $args['excluded_tags'] ) ) {
|
|
|
|
$query_args['tag__not_in'] = $args['excluded_tags'];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Excluded categories?
|
|
|
|
if ( ! empty( $args['excluded_cats'] ) ) {
|
|
|
|
$query_args['category__not_in'] = $args['excluded_cats'];
|
|
|
|
}
|
|
|
|
|
2023-09-16 22:59:43 +02:00
|
|
|
// Excluded authors?
|
|
|
|
if ( ! empty( $args['excluded_authors'] ) ) {
|
|
|
|
$query_args['author__not_in'] = $args['excluded_authors'];
|
|
|
|
}
|
|
|
|
|
2023-09-15 15:15:45 +02:00
|
|
|
// Ignore protected?
|
|
|
|
if ( $args['ignore_protected'] ) {
|
|
|
|
add_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
|
|
|
}
|
|
|
|
|
2023-03-09 11:08:23 +01:00
|
|
|
// Apply filters
|
2023-03-10 15:20:48 +01:00
|
|
|
$query_args = apply_filters( 'fictioneer_filter_shortcode_latest_updates_query_args', $query_args, $args );
|
2023-03-09 11:08:23 +01:00
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
// Query stories
|
2023-08-03 13:17:32 +02:00
|
|
|
$entries = fictioneer_shortcode_query( $query_args );
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2023-09-15 15:15:45 +02:00
|
|
|
// Remove temporary filters
|
|
|
|
remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
?>
|
|
|
|
|
2023-09-15 22:42:34 +02:00
|
|
|
<section class="small-card-block latest-updates <?php echo $args['classes']; ?>">
|
2023-01-21 01:31:34 +01:00
|
|
|
<?php if ( $entries->have_posts() ) : ?>
|
|
|
|
|
2024-01-19 14:55:50 +01:00
|
|
|
<ul class="grid-columns _collapse-on-mobile">
|
2023-01-21 01:31:34 +01:00
|
|
|
<?php while ( $entries->have_posts() ) : $entries->the_post(); ?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// Setup
|
2024-05-17 17:46:54 +02:00
|
|
|
$post_id = $post->ID;
|
|
|
|
$story = fictioneer_get_story_data( $post_id, false ); // Does not refresh comment count!
|
|
|
|
$story_link = get_post_meta( $post_id, 'fictioneer_story_redirect_link', true ) ?: get_permalink( $post_id );
|
2023-01-21 01:31:34 +01:00
|
|
|
$tags = get_option( 'fictioneer_show_tags_on_story_cards' ) ? get_the_tags( $post ) : false;
|
2024-04-14 14:43:40 +02:00
|
|
|
$grid_or_vertical = $args['vertical'] ? '_vertical' : '_grid';
|
2023-01-21 01:31:34 +01:00
|
|
|
$chapter_list = [];
|
2024-02-12 00:27:58 +01:00
|
|
|
$card_classes = [];
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
// Skip if no chapters
|
2023-08-28 10:43:04 +02:00
|
|
|
if ( $story['chapter_count'] < 1 ) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-02-12 00:27:58 +01:00
|
|
|
// Extra classes
|
2024-02-06 03:10:02 +01:00
|
|
|
if ( ! empty( $post->post_password ) ) {
|
2024-02-12 00:27:58 +01:00
|
|
|
$card_classes[] = '_password';
|
|
|
|
}
|
|
|
|
|
2024-08-18 22:54:52 +02:00
|
|
|
if ( ! $args['footer'] || in_array( $args['type'], ['simple', 'single'] ) ) {
|
2024-05-12 12:10:26 +02:00
|
|
|
$card_classes[] = '_no-footer';
|
|
|
|
}
|
|
|
|
|
2024-02-12 01:40:38 +01:00
|
|
|
if ( get_theme_mod( 'card_style', 'default' ) !== 'default' ) {
|
|
|
|
$card_classes[] = '_' . get_theme_mod( 'card_style' );
|
2024-02-06 03:10:02 +01:00
|
|
|
}
|
|
|
|
|
2024-04-14 15:54:35 +02:00
|
|
|
if ( $args['vertical'] ) {
|
|
|
|
$card_classes[] = '_vertical';
|
|
|
|
}
|
|
|
|
|
2024-05-14 18:40:52 +02:00
|
|
|
if ( $args['seamless'] ) {
|
2024-04-14 14:43:40 +02:00
|
|
|
$card_classes[] = '_seamless';
|
|
|
|
}
|
|
|
|
|
2024-05-29 00:01:31 +02:00
|
|
|
if ( ! $args['words'] ) {
|
|
|
|
$card_classes[] = '_no-chapter-words';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $args['date'] ) {
|
|
|
|
$card_classes[] = '_no-chapter-dates';
|
|
|
|
}
|
|
|
|
|
2024-08-18 22:09:18 +02:00
|
|
|
if ( ! $args['footer_chapters'] ) {
|
|
|
|
$card_classes[] = '_no-footer-chapters';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $args['footer_words'] ) {
|
|
|
|
$card_classes[] = '_no-footer-words';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $args['footer_date'] ) {
|
|
|
|
$card_classes[] = '_no-footer-date';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $args['footer_status'] ) {
|
|
|
|
$card_classes[] = '_no-footer-status';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $args['footer_rating'] ) {
|
|
|
|
$card_classes[] = '_no-footer-rating';
|
|
|
|
}
|
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
// Search for viable chapters...
|
|
|
|
$search_list = array_reverse( $story['chapter_ids'] );
|
|
|
|
|
|
|
|
foreach ( $search_list as $chapter_id ) {
|
2024-02-06 14:18:37 +01:00
|
|
|
$chapter_post = get_post( $chapter_id );
|
|
|
|
|
2024-08-15 13:44:40 +02:00
|
|
|
if ( get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) ) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $args['ignore_protected'] && $chapter_post->post_password ) {
|
2023-08-28 10:43:04 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2024-02-06 14:18:37 +01:00
|
|
|
$chapter_list[] = $chapter_post;
|
2023-08-28 10:43:04 +02:00
|
|
|
|
2024-07-27 01:33:40 +02:00
|
|
|
if ( count( $chapter_list ) > 1 ) {
|
2024-07-24 12:33:11 +02:00
|
|
|
break; // Max one or two
|
2023-08-28 10:43:04 +02:00
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
}
|
|
|
|
|
2024-07-27 01:33:40 +02:00
|
|
|
// Slice chapter list down
|
|
|
|
$chapter_list = array_slice( $chapter_list, 0, ( $args['single'] || $args['type'] === 'single' ) ? 1 : 2 );
|
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
// No viable chapters
|
2023-08-28 10:43:04 +02:00
|
|
|
if ( count( $chapter_list ) < 1 ) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
// Count actually rendered cards to account for buffer
|
2023-08-28 10:43:04 +02:00
|
|
|
if ( ++$card_counter > $args['count'] ) {
|
|
|
|
break;
|
|
|
|
}
|
2024-03-04 01:54:53 +01:00
|
|
|
|
2024-04-14 15:54:35 +02:00
|
|
|
// Truncate factor
|
|
|
|
$truncate_factor = '_1-1';
|
|
|
|
|
|
|
|
if ( $args['vertical'] ) {
|
|
|
|
$truncate_factor = count( $chapter_list ) > 1 ? '_2-2' : '_3-3';
|
|
|
|
} else {
|
|
|
|
$truncate_factor = count( $chapter_list ) > 1 ? '_1-1' : '_2-2';
|
|
|
|
}
|
|
|
|
|
2024-03-04 01:54:53 +01:00
|
|
|
// Card attributes
|
2024-04-14 14:43:40 +02:00
|
|
|
$attributes = [];
|
|
|
|
|
|
|
|
if ( $args['aspect_ratio'] ) {
|
|
|
|
$attributes['style'] = '--card-image-aspect-ratio: ' . $args['aspect_ratio'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$attributes = apply_filters( 'fictioneer_filter_card_attributes', $attributes, $post, 'shortcode-latest-updates' );
|
|
|
|
|
2024-03-04 01:54:53 +01:00
|
|
|
$card_attributes = '';
|
|
|
|
|
|
|
|
foreach ( $attributes as $key => $value ) {
|
|
|
|
$card_attributes .= esc_attr( $key ) . '="' . esc_attr( $value ) . '" ';
|
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
?>
|
|
|
|
|
2024-05-17 17:46:54 +02:00
|
|
|
<li class="post-<?php echo $post_id; ?> card _small _story-update <?php echo implode( ' ', $card_classes ); ?>" <?php echo $card_attributes; ?>>
|
2023-01-21 01:31:34 +01:00
|
|
|
<div class="card__body polygon">
|
|
|
|
|
2024-04-14 14:43:40 +02:00
|
|
|
<div class="card__main <?php echo $grid_or_vertical; ?> _small">
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-04-17 14:11:39 +02:00
|
|
|
<?php
|
|
|
|
do_action( 'fictioneer_shortcode_latest_updates_card_body', $post, $story, $args );
|
|
|
|
|
2024-04-18 12:03:00 +02:00
|
|
|
if ( $args['thumbnail'] ) {
|
2024-08-18 14:21:37 +02:00
|
|
|
fictioneer_render_thumbnail(
|
2024-04-18 12:03:00 +02:00
|
|
|
array(
|
2024-05-17 17:46:54 +02:00
|
|
|
'post_id' => $post_id,
|
2024-04-18 12:03:00 +02:00
|
|
|
'title' => $story['title'],
|
|
|
|
'classes' => 'card__image cell-img',
|
|
|
|
'permalink' => $story_link,
|
2024-04-18 16:09:27 +02:00
|
|
|
'lightbox' => $args['lightbox'],
|
2024-04-18 12:03:00 +02:00
|
|
|
'vertical' => $args['vertical'],
|
|
|
|
'seamless' => $args['seamless'],
|
|
|
|
'aspect_ratio' => $args['aspect_ratio']
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2024-04-17 14:11:39 +02:00
|
|
|
?>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-04-14 23:09:11 +02:00
|
|
|
<h3 class="card__title _small cell-title"><a href="<?php echo $story_link; ?>" class="truncate _1-1"><?php
|
2024-01-18 21:44:29 +01:00
|
|
|
if ( ! empty( $post->post_password ) ) {
|
|
|
|
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $story['title'];
|
|
|
|
?></a></h3>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
<div class="card__content _small cell-desc">
|
2024-04-14 15:54:35 +02:00
|
|
|
<div class="truncate <?php echo $truncate_factor; ?>">
|
2024-08-14 15:17:42 +02:00
|
|
|
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] ) : ?>
|
2023-06-04 14:02:12 +02:00
|
|
|
<span class="card__by-author"><?php
|
|
|
|
printf( _x( 'by %s —', 'Small card: by {Author} —.', 'fictioneer' ), fictioneer_get_author_node() );
|
|
|
|
?></span>
|
|
|
|
<?php endif; ?>
|
2023-01-21 01:31:34 +01:00
|
|
|
<span><?php
|
2023-11-30 16:03:53 +01:00
|
|
|
$short_description = fictioneer_first_paragraph_as_excerpt(
|
2024-05-17 17:46:54 +02:00
|
|
|
fictioneer_get_content_field( 'fictioneer_story_short_description', $post_id )
|
2023-11-30 16:03:53 +01:00
|
|
|
);
|
2024-07-30 09:26:23 +02:00
|
|
|
echo mb_strlen( $short_description, 'UTF-8' ) < 30 ? get_the_excerpt() : $short_description;
|
2023-01-21 01:31:34 +01:00
|
|
|
?></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<ol class="card__link-list _small cell-list">
|
2024-02-06 14:18:37 +01:00
|
|
|
<?php foreach ( $chapter_list as $chapter ) : ?>
|
|
|
|
<?php
|
|
|
|
// Chapter title
|
|
|
|
$list_title = get_post_meta( $chapter->ID, 'fictioneer_chapter_list_title', true );
|
|
|
|
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
|
|
|
|
|
|
|
if ( empty( $list_title ) ) {
|
2024-03-01 12:39:42 +01:00
|
|
|
$chapter_title = fictioneer_get_safe_title( $chapter->ID, 'shortcode-latest-updates' );
|
2024-02-06 14:18:37 +01:00
|
|
|
} else {
|
|
|
|
$chapter_title = $list_title;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extra classes
|
|
|
|
$list_item_classes = [];
|
|
|
|
|
|
|
|
if ( ! empty( $chapter->post_password ) ) {
|
|
|
|
$list_item_classes[] = '_password';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<li class="card__link-list-item <?php echo implode( ' ', $list_item_classes ); ?>">
|
2023-01-21 01:31:34 +01:00
|
|
|
<div class="card__left text-overflow-ellipsis">
|
|
|
|
<i class="fa-solid fa-caret-right"></i>
|
2024-02-06 14:18:37 +01:00
|
|
|
<a href="<?php the_permalink( $chapter->ID ); ?>" class="card__link-list-link"><?php
|
|
|
|
echo $chapter_title;
|
2023-01-21 01:31:34 +01:00
|
|
|
?></a>
|
|
|
|
</div>
|
2024-05-29 00:01:31 +02:00
|
|
|
<?php if ( $args['words'] || $args['date'] ) : ?>
|
|
|
|
<div class="card__right">
|
|
|
|
<?php
|
2024-06-03 12:02:30 +02:00
|
|
|
$words = $args['words'] ? fictioneer_get_word_count( $chapter->ID ) : 0;
|
|
|
|
|
|
|
|
if ( $words ) {
|
|
|
|
echo '<span class="words _words-' . $words . '">' . fictioneer_shorten_number( $words ) . '</span>';
|
2024-05-29 00:01:31 +02:00
|
|
|
}
|
|
|
|
|
2024-06-03 12:02:30 +02:00
|
|
|
if ( $words && $args['date'] ) {
|
2024-05-29 00:01:31 +02:00
|
|
|
echo '<span class="separator-dot"> • </span>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $args['date'] ) {
|
2024-08-21 22:53:24 +02:00
|
|
|
echo '<span class="date">' . get_the_date(
|
|
|
|
$args['nested_date_format'] ?: FICTIONEER_LATEST_UPDATES_LI_DATE, $chapter->ID
|
|
|
|
) . '</span>';
|
2024-05-29 00:01:31 +02:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
2023-01-21 01:31:34 +01:00
|
|
|
</li>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</ol>
|
|
|
|
|
2024-08-21 22:53:24 +02:00
|
|
|
<?php if ( $show_terms ) : ?>
|
2023-01-21 01:31:34 +01:00
|
|
|
<div class="card__tag-list _small _scrolling cell-tax">
|
2023-08-30 10:42:10 +02:00
|
|
|
<div class="card__h-scroll">
|
2023-01-21 01:31:34 +01:00
|
|
|
<?php
|
|
|
|
if ( $story['has_taxonomies'] || $tags ) {
|
2024-08-21 22:53:24 +02:00
|
|
|
$terms = [];
|
2023-06-04 01:49:00 +02:00
|
|
|
|
2023-01-21 01:31:34 +01:00
|
|
|
if ( $story['fandoms'] ) {
|
|
|
|
foreach ( $story['fandoms'] as $fandom ) {
|
2024-08-21 22:53:24 +02:00
|
|
|
$terms[ $fandom->term_id ] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
2023-01-21 01:31:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $story['genres'] ) {
|
|
|
|
foreach ( $story['genres'] as $genre ) {
|
2024-08-21 22:53:24 +02:00
|
|
|
$terms[ $genre->term_id ] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
2023-01-21 01:31:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $tags ) {
|
|
|
|
foreach ( $tags as $tag ) {
|
2024-08-21 22:53:24 +02:00
|
|
|
$terms[ $tag->term_id ] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
2023-01-21 01:31:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $story['characters'] ) {
|
|
|
|
foreach ( $story['characters'] as $character ) {
|
2024-08-21 22:53:24 +02:00
|
|
|
$terms[ $character->term_id ] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
2023-01-21 01:31:34 +01:00
|
|
|
}
|
|
|
|
}
|
2023-06-04 01:49:00 +02:00
|
|
|
|
2024-08-23 16:44:04 +02:00
|
|
|
$terms = apply_filters( 'fictioneer_filter_shortcode_latest_updates_terms', $terms, $post, $args, $story );
|
2024-08-21 22:53:24 +02:00
|
|
|
|
2024-08-23 13:56:17 +02:00
|
|
|
// Implode with separator
|
|
|
|
echo implode( fictioneer_get_bullet_separator( 'latest-updates' ), $terms );
|
2023-01-21 01:31:34 +01:00
|
|
|
} else {
|
|
|
|
?><span class="card__no-taxonomies"><?php _e( 'No taxonomies specified yet.', 'fictioneer' ); ?></span><?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
2024-08-18 22:54:52 +02:00
|
|
|
<?php if ( $args['footer'] && ! in_array( $args['type'], ['simple', 'single'] ) ) : ?>
|
2024-05-13 21:03:17 +02:00
|
|
|
<div class="card__footer cell-footer _small">
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-05-13 21:03:17 +02:00
|
|
|
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-05-13 21:03:17 +02:00
|
|
|
// Build footer items
|
|
|
|
$footer_items = [];
|
2023-06-04 22:17:42 +02:00
|
|
|
|
2024-08-18 22:09:18 +02:00
|
|
|
if ( $args['footer_chapters'] ) {
|
|
|
|
$footer_items['chapters'] = '<span class="card__footer-chapters"><i class="card-footer-icon fa-solid fa-list" title="' . esc_attr__( 'Chapters', 'fictioneer' ) . '"></i> ' . $story['chapter_count'] . '</span>';
|
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-08-18 22:09:18 +02:00
|
|
|
if ( $story['word_count'] > 0 && $args['footer_words'] ) {
|
2024-07-28 12:50:45 +02:00
|
|
|
$footer_items['words'] = '<span class="card__footer-words"><i class="card-footer-icon fa-solid fa-font" title="' . esc_attr__( 'Total Words', 'fictioneer' ) . '"></i> ' . $story['word_count_short'] . '</span>';
|
2024-06-03 12:02:30 +02:00
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-08-18 22:09:18 +02:00
|
|
|
if ( $args['footer_date'] ) {
|
2024-08-21 22:53:24 +02:00
|
|
|
$format = $args['date_format'] ?: FICTIONEER_LATEST_UPDATES_FOOTER_DATE;
|
|
|
|
|
|
|
|
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( $format, $post ) . '</span>';
|
2024-08-18 22:09:18 +02:00
|
|
|
}
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-08-18 22:09:18 +02:00
|
|
|
if ( $args['footer_status'] ) {
|
|
|
|
$footer_items['status'] = '<span class="card__footer-status"><i class="card-footer-icon ' . $story['icon'] . '"></i> ' . fcntr( $story['status'] ) . '</span>';
|
|
|
|
}
|
2023-06-04 22:17:42 +02:00
|
|
|
|
2024-05-13 21:03:17 +02:00
|
|
|
// Filter footer items
|
|
|
|
$footer_items = apply_filters(
|
|
|
|
'fictioneer_filter_shortcode_latest_updates_card_footer',
|
|
|
|
$footer_items,
|
|
|
|
$post,
|
|
|
|
$story,
|
|
|
|
$args
|
|
|
|
);
|
2023-09-10 16:34:15 +02:00
|
|
|
|
2024-05-13 21:03:17 +02:00
|
|
|
// Implode and render footer items
|
|
|
|
echo implode( ' ', $footer_items );
|
2023-09-10 16:34:15 +02:00
|
|
|
|
2024-05-13 21:03:17 +02:00
|
|
|
?></div>
|
2023-09-10 16:34:15 +02:00
|
|
|
|
2024-08-18 22:09:18 +02:00
|
|
|
<?php if ( $args['footer_rating'] ) : ?>
|
|
|
|
<div class="card__footer-box _right rating-letter-label tooltipped" data-tooltip="<?php echo fcntr( $story['rating'], true ); ?>">
|
|
|
|
<?php echo fcntr( $story['rating_letter'] ); ?>
|
|
|
|
</div>
|
|
|
|
<?php endif; ?>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
</div>
|
2024-05-13 21:03:17 +02:00
|
|
|
<?php endif; ?>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2024-05-13 21:03:17 +02:00
|
|
|
</div>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<?php endwhile; ?>
|
|
|
|
</ul>
|
|
|
|
|
2023-11-30 17:52:19 +01:00
|
|
|
<?php else : ?>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
2023-09-16 13:25:38 +02:00
|
|
|
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ); ?></div>
|
2023-01-21 01:31:34 +01:00
|
|
|
|
|
|
|
<?php endif; wp_reset_postdata(); ?>
|
|
|
|
</section>
|