Add single variant for Latest Updates shortcode
This commit is contained in:
parent
e2be8f34a6
commit
5a82b6679e
@ -1234,7 +1234,7 @@ Filters the WP_Query arguments in the `fictioneer_latest_updates` shortcode. The
|
||||
* $no_found_rows (boolean) – `true`
|
||||
|
||||
**$args:**
|
||||
* $simple (boolean|null) – Whether to render the simple variant. Default `false`.
|
||||
* $type (string) – Either `'default'`, `'simple'`, `'single'`, and `'compact'`.
|
||||
* $count (int) – Maximum number of posts. Default `-1`.
|
||||
* $author (boolean|string) – Limit posts to a specific author. Default `false`.
|
||||
* $order (string) – Order argument. Default `'DESC'`.
|
||||
|
@ -612,7 +612,7 @@ add_shortcode( 'fictioneer_story_cards', 'fictioneer_shortcode_latest_stories' )
|
||||
*
|
||||
* @param string|null $attr['count'] Optional. Maximum number of items. Default 4.
|
||||
* @param string|null $attr['author'] Optional. Limit posts to a specific author.
|
||||
* @param string|null $attr['type'] Optional. Choose between 'default', 'simple', and 'compact'.
|
||||
* @param string|null $attr['type'] Optional. Choose between 'default', 'simple', 'single', and 'compact'.
|
||||
* @param string|null $attr['post_ids'] Optional. Limit posts to specific post IDs.
|
||||
* @param string|null $attr['ignore_protected'] Optional. Whether to ignore protected posts. Default false.
|
||||
* @param string|null $attr['exclude_tag_ids'] Optional. Exclude posts with these tags.
|
||||
@ -663,7 +663,6 @@ function fictioneer_shortcode_latest_story_updates( $attr ) {
|
||||
get_template_part( 'partials/_latest-updates-compact', null, $args );
|
||||
break;
|
||||
default:
|
||||
$args['simple'] = $type == 'simple';
|
||||
get_template_part( 'partials/_latest-updates', null, $args );
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
* @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['simple'] Whether to show the simple variant.
|
||||
* @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.
|
||||
@ -150,7 +149,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_password';
|
||||
}
|
||||
|
||||
if ( $args['simple'] ) {
|
||||
if ( in_array( $args['type'], ['simple', 'single'] ) ) {
|
||||
$card_classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
@ -186,8 +185,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
$chapter_list[] = $chapter_post;
|
||||
|
||||
if ( count( $chapter_list ) > 1 ) {
|
||||
break; // Max two
|
||||
if ( count( $chapter_list ) > ( $args['type'] === 'single' ? 0 : 1 ) ) {
|
||||
break; // Max one or two
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,7 +324,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
|
||||
<?php if ( ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) && ! $args['simple'] ) : ?>
|
||||
<?php if (
|
||||
! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) && ! in_array( $args['type'], ['simple', 'single'] )
|
||||
) : ?>
|
||||
<div class="card__tag-list _small _scrolling cell-tax">
|
||||
<div class="card__h-scroll">
|
||||
<?php
|
||||
@ -366,7 +367,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! $args['simple'] ) : ?>
|
||||
<?php if ( ! in_array( $args['type'], ['simple', 'single'] ) ) : ?>
|
||||
<div class="card__footer cell-footer _small">
|
||||
|
||||
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
||||
|
Loading…
x
Reference in New Issue
Block a user