Add source param to Latest Chapters/Updates shortcode

This commit is contained in:
Tetrakern 2024-08-14 15:17:42 +02:00
parent b354e5e978
commit 810573943a
7 changed files with 14 additions and 7 deletions

View File

@ -1119,6 +1119,7 @@ Renders a multi-column grid of small cards, showing the latest four stories orde
* **genres:** Comma-separated list of genre names (case-insensitive), if you want to pick from a curated pool.
* **characters:** Comma-separated list of character names (case-insensitive), if you want to pick from a curated pool.
* **rel:** Relationship between different taxonomies, either `AND` or `OR`. Default `AND`.
* **source:** Set `false` to hide the author node. Default `true`.
* **vertical:** Whether to render the cards with the image on top. Default `false`.
* **seamless:** Whether to remove the gap between the image and frame. Default `false` (Customizer setting).
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).
@ -1172,6 +1173,7 @@ Renders a multi-column grid of small cards, showing the latest four updated stor
* **genres:** Comma-separated list of genre names (case-insensitive), if you want to pick from a curated pool.
* **characters:** Comma-separated list of character names (case-insensitive), if you want to pick from a curated pool.
* **rel:** Relationship between different taxonomies, either `AND` or `OR`. Default `AND`.
* **source:** Set `false` to hide the author node. Default `true`.
* **vertical:** Whether to render the cards with the image on top. Default `false`.
* **seamless:** Whether to remove the gap between the image and frame. Default `false` (Customizer setting).
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).

View File

@ -204,7 +204,8 @@ function fictioneer_get_default_shortcode_args( $attr, $def_count = -1 ) {
'words' => filter_var( $attr['words'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'date' => filter_var( $attr['date'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'classes' => esc_attr( wp_strip_all_tags( $attr['class'] ?? '' ) ),
'infobox' => filter_var( $attr['infobox'] ?? 1, FILTER_VALIDATE_BOOLEAN )
'infobox' => filter_var( $attr['infobox'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'source' => filter_var( $attr['source'] ?? 1, FILTER_VALIDATE_BOOLEAN )
);
//--- Fixes ------------------------------------------------------------------
@ -483,7 +484,6 @@ function fictioneer_shortcode_latest_chapters( $attr ) {
// Specifics
$args['simple'] = false;
$args['spoiler'] = filter_var( $attr['spoiler'] ?? 0, FILTER_VALIDATE_BOOLEAN );
$args['source'] = filter_var( $attr['source'] ?? 1, FILTER_VALIDATE_BOOLEAN );
// Type
$type = sanitize_text_field( $attr['type'] ?? 'default' );

View File

@ -14,7 +14,6 @@
* @internal $args['order'] Order of posts. Default 'DESC'.
* @internal $args['orderby'] Sorting of posts. Default 'date'.
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
* @internal $args['source'] Whether to show author and story.
* @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.
@ -23,6 +22,8 @@
* @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['spoiler'] Whether to obscure or show chapter excerpt.
* @internal $args['source'] Whether to show author and story.
* @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).

View File

@ -22,6 +22,7 @@
* @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.
@ -218,7 +219,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__content _small cell-desc">
<div class="truncate <?php echo $truncate_factor; ?>">
<?php if ( get_option( 'fictioneer_show_authors' ) ) : ?>
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] ) : ?>
<span class="card__by-author"><?php
printf( _x( 'by %s —', 'Small card: by {Author} —.', 'fictioneer' ), fictioneer_get_author_node() );
?></span>

View File

@ -22,6 +22,7 @@
* @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.
@ -199,7 +200,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__content _small cell-desc">
<div class="truncate <?php echo $truncate_factor; ?>">
<?php if ( get_option( 'fictioneer_show_authors' ) ) : ?>
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] ) : ?>
<span class="card__by-author"><?php
printf( _x( 'by %s —', 'Small card: by {Author} —.', 'fictioneer' ), fictioneer_get_author_node() );
?></span>

View File

@ -24,6 +24,7 @@
* @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.
@ -257,7 +258,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__content _small cell-desc">
<div class="truncate <?php echo $truncate_factor; ?>">
<?php if ( get_option( 'fictioneer_show_authors' ) ) : ?>
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] ) : ?>
<span class="card__by-author"><?php
printf( _x( 'by %s —', 'Small card: by {Author} —.', 'fictioneer' ), fictioneer_get_author_node() );
?></span>

View File

@ -25,6 +25,7 @@
* @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.
@ -263,7 +264,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__content _small cell-desc">
<div class="truncate <?php echo $truncate_factor; ?>">
<?php if ( get_option( 'fictioneer_show_authors' ) ) : ?>
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] ) : ?>
<span class="card__by-author"><?php
printf( _x( 'by %s —', 'Small card: by {Author} —.', 'fictioneer' ), fictioneer_get_author_node() );
?></span>