diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index de916bd2..ad2d2cef 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -840,6 +840,7 @@ Renders a multi-column grid of paginated medium cards ordered by publishing date * **post_type:** Comma-separated list of post types to query. Default `post`. * **post_ids:** Comma-separated list of post IDs, if you want to pick from a curated pool. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **per_page:** Number of posts per page. Defaults to theme settings. * **count:** Limit articles to any positive number, disabling the pagination. * **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`. @@ -900,6 +901,7 @@ Renders paginated blog posts akin to the main blog page, but with options. Only * **ignore_sticky:** Whether sticky posts should be ignored or not. Default `false`. * **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **only_protected:** Whether to query only protected posts or not. Default `false`. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **author:** Only show posts of a specific author. Make sure to use the url-safe nice_name. * **author_ids:** Only show posts of a comma-separated list of author IDs. * **exclude_author_ids:** Comma-separated list of author IDs to exclude. @@ -951,6 +953,7 @@ Renders a multi-column grid of small bookmark cards, ordered by date of creation Renders a list of chapters identical to those on story pages, ordered by sequence in the source. Must have either the **story_id** or **chapter_ids** parameter, but not both. * **story_id:** ID of a single story. You need either this or **chapters**. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **chapter_ids:** Comma-separated list of chapter IDs. You need either this or **story**. * **count:** Limit chapters to any positive number. Default `-1` (all). * **offset:** Skip a number of chapters, which can make sense if you query all. @@ -1023,6 +1026,7 @@ Renders a multi-column grid of small cards, showing the latest four chapters ord * **spoiler:** The excerpt is obfuscated, set `true` if you want to reveal it. Default `false`. * **source:** Whether to show the author and story nodes. Default `true`. * **post_ids:** Comma-separated list of chapter post IDs, if you want to pick from a curated pool. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **only_protected:** Whether to query only protected posts or not. Default `false`. * **author_ids:** Only show posts of a comma-separated list of author IDs. @@ -1089,6 +1093,7 @@ Renders the last blog post or a list of blog posts, ignoring sticky posts, order * **count:** Limit posts to any positive number, although you should keep it reasonable. Default `1`. * **author:** Only show posts of a specific author. Make sure to use the url-safe nice_name. * **post_ids:** Comma-separated list of post IDs, if you want to pick from a curated pool. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **only_protected:** Whether to query only protected posts or not. Default `false`. * **author_ids:** Only show posts of a comma-separated list of author IDs. @@ -1125,6 +1130,7 @@ Renders a multi-column grid of small cards, showing the latest four recommendati * **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`. * **orderby:** The default is `date`, but you can also use `modified` and [more](https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters). * **post_ids:** Comma-separated list of post IDs, if you want to pick from a curated pool. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **only_protected:** Whether to query only protected posts or not. Default `false`. * **author_ids:** Only show posts of a comma-separated list of author IDs. @@ -1178,6 +1184,7 @@ Renders a multi-column grid of small cards, showing the latest four stories orde * **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`. * **orderby:** The default is `date`, but you can also use `modified` and [more](https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters). * **post_ids:** Comma-separated list of story post IDs, if you want to pick from a curated pool. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **only_protected:** Whether to query only protected posts or not. Default `false`. * **author_ids:** Only show posts of a comma-separated list of author IDs. @@ -1256,6 +1263,7 @@ Renders a multi-column grid of small cards, showing the latest four updated stor * **author:** Only show updates of a specific author. Make sure to use the url-safe nice_name. * **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`. * **post_ids:** Comma-separated list of post IDs, if you want to pick from a curated pool. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **only_protected:** Whether to query only protected posts or not. Default `false`. * **author_ids:** Only show posts of a comma-separated list of author IDs. @@ -1370,6 +1378,7 @@ Renders dynamic grid of thumbnails with title, showing the latest eight posts of * **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`. * **orderby:** The default is `date`, but you can also use `rand` and [more](https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters). * **post_ids:** Comma-separated list of post IDs, if you want to pick from a curated pool. +* **post_status:** Either `publish` or `future`, albeit others are possible (but why?). Default `publish`. * **ignore_protected:** Whether protected posts should be ignored or not. Default `false`. * **only_protected:** Whether to query only protected posts or not. Default `false`. * **author_ids:** Only show posts of a comma-separated list of author IDs. diff --git a/includes/functions/_setup-shortcodes.php b/includes/functions/_setup-shortcodes.php index bba5463a..a893b743 100644 --- a/includes/functions/_setup-shortcodes.php +++ b/includes/functions/_setup-shortcodes.php @@ -167,6 +167,7 @@ function fictioneer_get_default_shortcode_args( $attr, $def_count = -1 ) { 'orderby' => $attr['orderby'] ?? '', 'page' => max( 1, get_query_var( 'page' ) ?: get_query_var( 'paged' ) ), 'posts_per_page' => absint( $attr['per_page'] ?? 0 ) ?: get_option( 'posts_per_page' ), + 'post_status' => sanitize_key( $attr['post_status'] ?? 'publish' ), 'post_ids' => fictioneer_explode_list( $attr['post_ids'] ?? '' ), 'author' => sanitize_title( $attr['author'] ?? '' ), 'author_ids' => fictioneer_explode_list( $attr['author_ids'] ?? '' ), @@ -411,6 +412,7 @@ function fictioneer_get_splide_inline_init() { * collections, recommendations, and stories. * @param string|null $attr['count'] Optional. Maximum number of items. Default 8. * @param string|null $attr['author'] Optional. Limit posts to a specific author. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['order'] Optional. Order direction. Default 'DESC'. * @param string|null $attr['orderby'] Optional. Order argument. Default 'date'. * @param string|null $attr['post_ids'] Optional. Limit posts to specific post IDs. @@ -528,6 +530,7 @@ add_shortcode( 'fictioneer_showcase', 'fictioneer_shortcode_showcase' ); * @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['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['order'] Optional. Order argument. Default 'DESC'. * @param string|null $attr['orderby'] Optional. Orderby argument. Default 'date'. * @param string|null $attr['spoiler'] Optional. Whether to show spoiler content. @@ -635,6 +638,7 @@ add_shortcode( 'fictioneer_latest_chapters', 'fictioneer_shortcode_latest_chapte * @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' and 'compact'. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['order'] Optional. Order argument. Default 'DESC'. * @param string|null $attr['orderby'] Optional. Orderby argument. Default 'date'. * @param string|null $attr['post_ids'] Optional. Limit posts to specific post IDs. @@ -746,6 +750,7 @@ add_shortcode( 'fictioneer_latest_stories', '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', 'single', and 'compact'. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['single'] Optional. Whether to show only one chapter item. Default false. * @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. @@ -860,6 +865,7 @@ add_shortcode( 'fictioneer_latest_updates', 'fictioneer_shortcode_latest_story_u * @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' and 'compact'. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['order'] Optional. Order argument. Default 'DESC'. * @param string|null $attr['orderby'] Optional. Orderby argument. Default 'date'. * @param string|null $attr['post_ids'] Optional. Limit posts to specific post IDs. @@ -952,6 +958,7 @@ add_shortcode( 'fictioneer_latest_recommendations', 'fictioneer_shortcode_latest * * @param string|null $attr['count'] Optional. Maximum number of items. Default 1. * @param string|null $attr['author'] Optional. Limit posts to a specific author. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @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['only_protected'] Optional. Whether to query only protected posts. Default false. @@ -1108,6 +1115,7 @@ function fictioneer_shortcode_chapter_list_empty( $attr ) { * @since 5.0.0 * * @param string $attr['story_id'] Either/Or. The ID of the story the chapters belong to. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['chapter_ids'] Either/Or. Comma-separated list of chapter IDs. * @param string|null $attr['count'] Optional. Maximum number of items. Default -1 (all). * @param string|null $attr['offset'] Optional. Skip a number of posts. @@ -1133,6 +1141,7 @@ function fictioneer_shortcode_chapter_list( $attr ) { $offset = max( 0, intval( $attr['offset'] ?? 0 ) ); $group = empty( $attr['group'] ) ? false : strtolower( trim( $attr['group'] ) ); $heading = empty( $attr['heading'] ) ? false : $attr['heading']; + $post_status = sanitize_key( $attr['post_status'] ?? 'publish' ); $story_id = fictioneer_validate_id( $attr['story_id'] ?? -1, 'fcn_story' ); $prefer_chapter_icon = get_option( 'fictioneer_override_chapter_status_icons' ); $hide_icons = get_option( 'fictioneer_hide_chapter_icons' ); @@ -1181,7 +1190,7 @@ function fictioneer_shortcode_chapter_list( $attr ) { $query_args = array( 'fictioneer_query_name' => 'fictioneer_shortcode_chapter_list', 'post_type' => 'fcn_chapter', - 'post_status' => 'publish', + 'post_status' => $post_status, 'post__in' => $chapters, // Cannot be empty! 'ignore_sticky_posts' => true, 'orderby' => 'post__in', // Preserve order from meta box @@ -1571,6 +1580,7 @@ add_shortcode( 'fictioneer_search', 'fictioneer_shortcode_search' ); * @param string|null $attr['ignore_protected'] Optional. Whether to ignore protected posts. Default false. * @param string|null $attr['only_protected'] Optional. Whether to query only protected posts. Default false. * @param string|null $attr['author'] Optional. Limit posts to a specific author. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['author_ids'] Optional. Only include posts by these author IDs. * @param string|null $attr['exclude_author_ids'] Optional. Exclude posts with these author IDs. * @param string|null $attr['exclude_tag_ids'] Optional. Exclude posts with these tags. @@ -1591,7 +1601,7 @@ function fictioneer_shortcode_blog( $attr ) { $query_args = array( 'fictioneer_query_name' => 'blog_shortcode', 'post_type' => 'post', - 'post_status' => 'publish', + 'post_status' => $args['post_status'], 'paged' => $args['page'], 'posts_per_page' => $args['posts_per_page'], 'ignore_sticky_posts' => $args['ignore_sticky'] @@ -1715,6 +1725,7 @@ add_shortcode( 'fictioneer_blog', 'fictioneer_shortcode_blog' ); * @since 5.7.3 * * @param string|null $attr['post_type'] Optional. The post types to query. Default 'post'. + * @param string|null $attr['post_status'] Optional. Choose a valid post status. Default 'publish'. * @param string|null $attr['post_ids'] Optional. Limit posts to specific post IDs. * @param string|null $attr['per_page'] Optional. Number of posts per page. * @param string|null $attr['count'] Optional. Maximum number of posts. Default -1. diff --git a/partials/_article-cards.php b/partials/_article-cards.php index 30209e69..6755f365 100644 --- a/partials/_article-cards.php +++ b/partials/_article-cards.php @@ -19,6 +19,7 @@ * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['page'] The current page. Default 1. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -50,7 +51,7 @@ $show_terms = ! in_array( $args['terms'], ['none', 'false'] ); $query_args = array( 'fictioneer_query_name' => 'article_cards', 'post_type' => $args['post_type'], - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'], diff --git a/partials/_latest-chapters-compact.php b/partials/_latest-chapters-compact.php index aee3fda2..a0795000 100644 --- a/partials/_latest-chapters-compact.php +++ b/partials/_latest-chapters-compact.php @@ -17,6 +17,7 @@ * @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['post_status'] Queried post status. Default 'publish'. * @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. @@ -51,7 +52,7 @@ $card_counter = 0; $query_args = array( 'fictioneer_query_name' => 'latest_chapters_compact', 'post_type' => 'fcn_chapter', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'], diff --git a/partials/_latest-chapters-list.php b/partials/_latest-chapters-list.php index e25be2b0..1d029d52 100644 --- a/partials/_latest-chapters-list.php +++ b/partials/_latest-chapters-list.php @@ -16,6 +16,7 @@ * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['spoiler'] Whether to obscure or show chapter excerpt. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -56,7 +57,7 @@ $content_list_style = get_theme_mod( 'content_list_style', 'default' ); $query_args = array( 'fictioneer_query_name' => 'latest_chapters_list', 'post_type' => 'fcn_chapter', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'orderby' => $args['orderby'], 'order' => $args['order'], diff --git a/partials/_latest-chapters.php b/partials/_latest-chapters.php index 0a9e3091..93f99226 100644 --- a/partials/_latest-chapters.php +++ b/partials/_latest-chapters.php @@ -16,6 +16,7 @@ * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['spoiler'] Whether to obscure or show chapter excerpt. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -56,7 +57,7 @@ $card_counter = 0; $query_args = array( 'fictioneer_query_name' => 'latest_chapters', 'post_type' => 'fcn_chapter', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'orderby' => $args['orderby'], 'order' => $args['order'], diff --git a/partials/_latest-posts.php b/partials/_latest-posts.php index 3bc423ed..fd9dfcee 100644 --- a/partials/_latest-posts.php +++ b/partials/_latest-posts.php @@ -13,6 +13,7 @@ * @internal $args['author'] The author provided by the shortcode. Default false. * @internal $args['count'] The number of posts provided by the shortcode. Default 1. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -32,7 +33,7 @@ defined( 'ABSPATH' ) OR exit; $query_args = array( 'fictioneer_query_name' => 'latest_posts', 'post_type' => 'post', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => 'DESC', 'orderby' => 'date', diff --git a/partials/_latest-recommendations-compact.php b/partials/_latest-recommendations-compact.php index 03c52c5a..de507b8f 100644 --- a/partials/_latest-recommendations-compact.php +++ b/partials/_latest-recommendations-compact.php @@ -15,6 +15,7 @@ * @internal $args['order'] Order of posts. Default 'DESC'. * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -48,7 +49,7 @@ $show_terms = ! in_array( $args['terms'], ['none', 'false'] ) && $query_args = array ( 'fictioneer_query_name' => 'latest_recommendations_compact', 'post_type' => 'fcn_recommendation', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'], diff --git a/partials/_latest-recommendations.php b/partials/_latest-recommendations.php index 817e1e45..44ceab59 100644 --- a/partials/_latest-recommendations.php +++ b/partials/_latest-recommendations.php @@ -15,6 +15,7 @@ * @internal $args['order'] Order of posts. Default 'DESC'. * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @internal $args['author_ids'] Array of author IDs. Default empty. * @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.s * @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty. @@ -46,7 +47,7 @@ $show_terms = ! get_option( 'fictioneer_hide_taxonomies_on_recommendation_cards' $query_args = array ( 'fictioneer_query_name' => 'latest_recommendations', 'post_type' => 'fcn_recommendation', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'], diff --git a/partials/_latest-stories-compact.php b/partials/_latest-stories-compact.php index 2229676e..2e5e2bcb 100644 --- a/partials/_latest-stories-compact.php +++ b/partials/_latest-stories-compact.php @@ -16,6 +16,7 @@ * @internal $args['order'] Order of posts. Default 'DESC'. * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -56,7 +57,7 @@ $show_terms = ! in_array( $args['terms'], ['none', 'false'] ) && $query_args = array( 'fictioneer_query_name' => 'latest_stories_compact', 'post_type' => 'fcn_story', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'], diff --git a/partials/_latest-stories-list.php b/partials/_latest-stories-list.php index cfcf782c..55e03576 100644 --- a/partials/_latest-stories-list.php +++ b/partials/_latest-stories-list.php @@ -16,6 +16,7 @@ * @internal $args['order'] Order of posts. Default 'DESC'. * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -57,7 +58,7 @@ $content_list_style = get_theme_mod( 'content_list_style', 'default' ); $query_args = array( 'fictioneer_query_name' => 'latest_stories_list', 'post_type' => 'fcn_story', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'], diff --git a/partials/_latest-stories.php b/partials/_latest-stories.php index 5c598e85..e940fcde 100644 --- a/partials/_latest-stories.php +++ b/partials/_latest-stories.php @@ -16,6 +16,7 @@ * @internal $args['order'] Order of posts. Default 'DESC'. * @internal $args['orderby'] Sorting of posts. Default 'date'. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -57,7 +58,7 @@ $show_terms = ! in_array( $args['terms'], ['none', 'false'] ) && $query_args = array( 'fictioneer_query_name' => 'latest_stories', 'post_type' => 'fcn_story', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'], diff --git a/partials/_latest-updates-compact.php b/partials/_latest-updates-compact.php index b28d905d..8ef8cb8d 100644 --- a/partials/_latest-updates-compact.php +++ b/partials/_latest-updates-compact.php @@ -18,6 +18,7 @@ * @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['post_status'] Queried post status. Default 'publish'. * @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. @@ -59,7 +60,7 @@ $card_counter = 0; $query_args = array( 'fictioneer_query_name' => 'latest_updates_compact', 'post_type' => 'fcn_story', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => 'meta_value', diff --git a/partials/_latest-updates-list.php b/partials/_latest-updates-list.php index b1161e5a..ec2f326d 100644 --- a/partials/_latest-updates-list.php +++ b/partials/_latest-updates-list.php @@ -18,6 +18,7 @@ * @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['post_status'] Queried post status. Default 'publish'. * @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. @@ -62,7 +63,7 @@ $content_list_style = get_theme_mod( 'content_list_style', 'default' ); $query_args = array( 'fictioneer_query_name' => 'latest_updates_list', 'post_type' => 'fcn_story', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => 'meta_value', diff --git a/partials/_latest-updates.php b/partials/_latest-updates.php index 8c61314b..b22b9122 100644 --- a/partials/_latest-updates.php +++ b/partials/_latest-updates.php @@ -19,6 +19,7 @@ * @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['post_status'] Queried post status. Default 'publish'. * @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. @@ -65,7 +66,7 @@ $show_terms = ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) && $query_args = array( 'fictioneer_query_name' => 'latest_updates', 'post_type' => 'fcn_story', - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => 'meta_value', diff --git a/partials/_showcase.php b/partials/_showcase.php index 135afa9d..dee3a4b4 100644 --- a/partials/_showcase.php +++ b/partials/_showcase.php @@ -18,6 +18,7 @@ * @internal $args['orderby'] Order argument. Default 'date'. * @internal $args['author'] Author provided by the shortcode. * @internal $args['post_ids'] Array of post IDs. Default empty. + * @internal $args['post_status'] Queried post status. Default 'publish'. * @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. @@ -46,7 +47,7 @@ $splide = $args['splide'] ?? 0; $query_args = array ( 'fictioneer_query_name' => 'showcase', 'post_type' => $args['post_type'], - 'post_status' => 'publish', + 'post_status' => $args['post_status'] ?? 'publish', 'post__in' => $args['post_ids'], // May be empty! 'order' => $args['order'], 'orderby' => $args['orderby'],