Update latest updates shortcode
This commit is contained in:
parent
977609a6f8
commit
359f5d5ca1
40
FILTERS.md
40
FILTERS.md
@ -742,7 +742,7 @@ Filters the query arguments in the `fictioneer_latest_chapters` shortcode. The o
|
||||
* $post_status (string) – `'publish'`
|
||||
* $order (string) – `$args['order']`
|
||||
* $orderby (string) – `$args['orderby']`
|
||||
* $posts_per_page (int) – `$args['count'] + 8` (buffer for disabled posts)
|
||||
* $posts_per_page (int) – `$args['count'] + 8` (buffer for invalid posts)
|
||||
* $post__in (array) – `$args['post_ids']`
|
||||
* $author_name (string|null) – `$args['author']`
|
||||
* $category__not_in (array|null) – `$args['excluded_cats']`
|
||||
@ -914,28 +914,38 @@ Filters the intermediate output array in the `_latest-updates.php` partial befor
|
||||
Filters the query arguments in the `fictioneer_latest_updates` shortcode. The optional taxonomy arrays can include categories, tags, fandoms, genres, and characters.
|
||||
|
||||
**$query_args:**
|
||||
* $fictioneer_query_name (string) – `'latest_updates'` or `'latest_updates_compact'`
|
||||
* $post_type (string) – `'fcn_story'`
|
||||
* $post_status (string) – `'publish'`
|
||||
* $author_name (string|null) – `$args['author']`
|
||||
* $post__in (array) – `$args['post_ids']`
|
||||
* $order (string) – `$args['order']`
|
||||
* $orderby (string) – `'meta_value'`
|
||||
* $meta_key (string) – `'fictioneer_chapters_added'`
|
||||
* $posts_per_page (int) – `$args['count'] + 4` (buffer for invalid posts)
|
||||
* $meta_query (array)
|
||||
* $relation (string) – `'OR'`
|
||||
* (array)
|
||||
* $key – `'fictioneer_story_hidden'`
|
||||
* $value – `'0'`
|
||||
* (array)
|
||||
* $key – `'fictioneer_story_hidden'`
|
||||
* $compare – `'NOT EXISTS'`
|
||||
* $author_name (string|null) – `$args['author']`
|
||||
* $category__not_in (array|null) – `$args['excluded_cats']`
|
||||
* $tag__not_in (array|null) – `$args['excluded_tags']`
|
||||
* $meta_key (string) – `'fictioneer_chapters_added'`
|
||||
* $orderby (string) – `'meta_value'`
|
||||
* $order (string) – `$args['order']`
|
||||
* $posts_per_page (int) – `$args['count'] + 4`
|
||||
* $tax_query (array|null) – `fictioneer_get_shortcode_tax_query( $args )`
|
||||
* $no_found_rows (boolean) – `true`
|
||||
|
||||
**$args:**
|
||||
* $simple (boolean) – Whether to render the simple variants. Default `false`.
|
||||
* $author (boolean|string) – The author provided by the shortcode. Default `false`.
|
||||
* $count (int) – The number of posts provided by the shortcode. Default `1`.
|
||||
* $order (string) – Optional. Default `'DESC'`.
|
||||
* $post_ids (\[string]) – Array of post IDs. Default empty.
|
||||
* $ignore_protected (boolean) – Optional. Whether to ignore protected posts. Default `false`.
|
||||
* $excluded_cats (\[string]) – Array of category IDs to exclude. Default empty.
|
||||
* $excluded_tags (\[string]) – Array of tag IDs to exclude. Default empty.
|
||||
* $taxonomies (\[array]) – Array of taxonomy arrays (names). Default empty.
|
||||
* $simple (boolean|null) – Whether to render the simple variant. Default `false`.
|
||||
* $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'`.
|
||||
* $post_ids (array) – Limit posts to specific post IDs. Default empty.
|
||||
* $excluded_tags (array) – Exclude specific tag names. Default empty.
|
||||
* $excluded_cats (array) – Exclude specific category names. Default empty.
|
||||
* $ignore_protected (boolean) – Whether to ignore protected posts. Default `false`.
|
||||
* $taxonomies (array) – Array of arrays of required taxonomy names. Default empty.
|
||||
* $relation (string) – Relationship between taxonomies. Default `'AND'`.
|
||||
* $classes (string) – String of additional CSS classes. Default empty.
|
||||
|
||||
|
@ -39,9 +39,9 @@ $query_args = array(
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => $args['post_ids'], // May be empty!
|
||||
'meta_key' => 'fictioneer_chapters_added',
|
||||
'order' => $args['order'],
|
||||
'orderby' => 'meta_value',
|
||||
'order' => $args['order'] ?? 'DESC',
|
||||
'meta_key' => 'fictioneer_chapters_added',
|
||||
'posts_per_page' => $args['count'] + 4, // Little buffer in case of no viable chapters
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
@ -58,8 +58,10 @@ $query_args = array(
|
||||
'update_post_term_cache' => false
|
||||
);
|
||||
|
||||
// Parameter for author?
|
||||
if ( isset( $args['author'] ) && $args['author'] ) $query_args['author_name'] = $args['author'];
|
||||
// Author?
|
||||
if ( isset( $args['author'] ) && $args['author'] ) {
|
||||
$query_args['author_name'] = $args['author'];
|
||||
}
|
||||
|
||||
// Taxonomies?
|
||||
if ( ! empty( $args['taxonomies'] ) ) {
|
||||
@ -128,7 +130,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
// Count actually rendered cards to account for buffer
|
||||
if ( ++$card_counter > $args['count'] ) break;
|
||||
if ( ++$card_counter > $args['count'] ) {
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
||||
<li class="card watch-last-clicked _small _info">
|
||||
@ -201,7 +205,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ) ?></div>
|
||||
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ); ?></div>
|
||||
|
||||
<?php endif; wp_reset_postdata(); ?>
|
||||
</section>
|
||||
|
@ -41,9 +41,9 @@ $query_args = array(
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => $args['post_ids'], // May be empty!
|
||||
'meta_key' => 'fictioneer_chapters_added',
|
||||
'order' => $args['order'],
|
||||
'orderby' => 'meta_value',
|
||||
'order' => $args['order'] ?? 'DESC',
|
||||
'meta_key' => 'fictioneer_chapters_added',
|
||||
'posts_per_page' => $args['count'] + 4, // Little buffer in case of no viable stories
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
@ -59,8 +59,10 @@ $query_args = array(
|
||||
'no_found_rows' => true
|
||||
);
|
||||
|
||||
// Parameter for author?
|
||||
if ( isset( $args['author'] ) && $args['author'] ) $query_args['author_name'] = $args['author'];
|
||||
// Author?
|
||||
if ( isset( $args['author'] ) && $args['author'] ) {
|
||||
$query_args['author_name'] = $args['author'];
|
||||
}
|
||||
|
||||
// Taxonomies?
|
||||
if ( ! empty( $args['taxonomies'] ) ) {
|
||||
@ -281,7 +283,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ) ?></div>
|
||||
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ); ?></div>
|
||||
|
||||
<?php endif; wp_reset_postdata(); ?>
|
||||
</section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user