Add UID argument to several shortcodes

This commit is contained in:
Tetrakern 2024-10-06 23:17:22 +02:00
parent 25b3a01b4c
commit 081c2c77cb
15 changed files with 18 additions and 1 deletions

View File

@ -173,7 +173,10 @@ function fictioneer_get_default_shortcode_args( $attr, $def_count = -1 ) {
$seamless_default = get_theme_mod( 'card_image_style', 'default' ) === 'seamless';
$thumbnail_default = get_theme_mod( 'card_image_style', 'default' ) !== 'none';
$uid = wp_unique_id( 'shortcode-id-' );
$args = array(
'uid' => $uid,
'type' => $attr['type'] ?? 'default',
'count' => max( -1, intval( $attr['count'] ?? $def_count ) ),
'offset' => max( 0, intval( $attr['offset'] ?? 0 ) ),
@ -209,7 +212,7 @@ function fictioneer_get_default_shortcode_args( $attr, $def_count = -1 ) {
'footer_comments' => filter_var( $attr['footer_comments'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'footer_status' => filter_var( $attr['footer_status'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'footer_rating' => filter_var( $attr['footer_rating'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'classes' => esc_attr( wp_strip_all_tags( $attr['classes'] ?? $attr['class'] ?? '' ) ),
'classes' => esc_attr( wp_strip_all_tags( $attr['classes'] ?? $attr['class'] ?? '' ) ) . " {$uid}",
'infobox' => filter_var( $attr['infobox'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'source' => filter_var( $attr['source'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
'splide' => sanitize_text_field( $attr['splide'] ?? '' ),

View File

@ -8,6 +8,7 @@
* @subpackage Fictioneer
* @since 5.7.3
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['post_type'] Array of post types to query. Default 'post'.
* @internal $args['ignore_sticky'] Whether to ignore sticky flags. Default false.
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.

View File

@ -8,6 +8,7 @@
* @subpackage Fictioneer
* @since 4.0.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode ('compact').
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -8,6 +8,7 @@
* @subpackage Fictioneer
* @since 5.23.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -8,6 +8,7 @@
* @subpackage Fictioneer
* @since 4.0.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -8,6 +8,7 @@
* @subpackage Fictioneer
* @since 4.0.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
* @internal $args['author'] The author provided by the shortcode. Default false.
* @internal $args['count'] The number of posts provided by the shortcode. Default 1.

View File

@ -8,6 +8,7 @@
* @subpackage Fictioneer
* @since 4.0.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode ('compact').
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -8,6 +8,7 @@
* @subpackage Fictioneer
* @since 4.0.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -9,6 +9,7 @@
* @since 4.0.0
* @see fictioneer_clause_sticky_stories()
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode ('compact').
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -9,6 +9,7 @@
* @since 5.23.0
* @see fictioneer_clause_sticky_stories()
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode.
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -9,6 +9,7 @@
* @since 4.0.0
* @see fictioneer_clause_sticky_stories()
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode.
* @internal $args['count'] Number of posts provided by the shortcode.
* @internal $args['author'] Author provided by the shortcode.

View File

@ -11,6 +11,7 @@
* @subpackage Fictioneer
* @since 4.3.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['type'] Type argument passed from shortcode ('compact').
* @internal $args['single'] Whether to show only one chapter item. Default false.
* @internal $args['count'] Number of posts provided by the shortcode.

View File

@ -11,6 +11,7 @@
* @subpackage Fictioneer
* @since 5.23.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @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.

View File

@ -12,6 +12,7 @@
* @subpackage Fictioneer
* @since 4.3.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @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.

View File

@ -11,6 +11,7 @@
* @subpackage Fictioneer
* @since 4.0.0
*
* @internal $args['uid'] Unique ID of the shortcode. Pattern: shortcode-id-{id}.
* @internal $args['post_type'] Post type if the showcase.
* @internal $args['count'] Maximum number of items. Default 8.
* @internal $args['order'] Order direction. Default 'DESC'.