Add post status CSS to shortcode outputs

This commit is contained in:
Tetrakern 2025-01-12 18:00:18 +01:00
parent d614b973c4
commit 9360506c2e
14 changed files with 45 additions and 23 deletions

View File

@ -51,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -176,6 +176,8 @@ if ( $splide ) {
}
// Extra classes
$card_classes[] = '_' . $args['post_status'];
if ( get_theme_mod( 'card_style', 'default' ) !== 'default' ) {
$card_classes[] = '_' . get_theme_mod( 'card_style' );
}

View File

@ -52,7 +52,7 @@ $card_counter = 0;
$query_args = array(
'fictioneer_query_name' => 'latest_chapters_compact',
'post_type' => 'fcn_chapter',
'post_status' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -169,6 +169,8 @@ if ( $splide ) {
$card_classes = [];
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}

View File

@ -57,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'orderby' => $args['orderby'],
'order' => $args['order'],
@ -201,7 +201,7 @@ if ( $splide ) {
}
// Extra classes
$classes = [];
$classes = [ '_' . $args['post_status'] ];
if ( ! empty( $post->post_password ) ) {
$classes[] = '_password';

View File

@ -57,7 +57,7 @@ $card_counter = 0;
$query_args = array(
'fictioneer_query_name' => 'latest_chapters',
'post_type' => 'fcn_chapter',
'post_status' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'orderby' => $args['orderby'],
'order' => $args['order'],
@ -178,6 +178,8 @@ if ( $splide ) {
}
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}

View File

@ -33,7 +33,7 @@ defined( 'ABSPATH' ) OR exit;
$query_args = array(
'fictioneer_query_name' => 'latest_posts',
'post_type' => 'post',
'post_status' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => 'DESC',
'orderby' => 'date',
@ -89,6 +89,9 @@ $query_args = apply_filters( 'fictioneer_filter_shortcode_latest_posts_query_arg
// Query post
$latest_entries = fictioneer_shortcode_query( $query_args );
// Classes
$args['classes'] .= ' _' . $args['post_status'];
?>
<section class="latest-posts <?php echo $args['classes']; ?>">

View File

@ -49,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -144,7 +144,9 @@ if ( $splide ) {
$grid_or_vertical = $args['vertical'] ? '_vertical' : '_grid';
$card_classes = [];
// Extra classes
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( $show_terms ) {
$card_classes[] = '_info';
}

View File

@ -47,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -141,7 +141,9 @@ if ( $splide ) {
$grid_or_vertical = $args['vertical'] ? '_vertical' : '_grid';
$card_classes = [];
// Extra classes
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( get_theme_mod( 'card_style', 'default' ) !== 'default' ) {
$card_classes[] = '_' . get_theme_mod( 'card_style' );
}

View File

@ -57,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -172,7 +172,9 @@ if ( $splide ) {
);
$short_description = mb_strlen( $short_description, 'UTF-8' ) < 30 ? get_the_excerpt() : $short_description;
// Extra classes
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( $show_terms ) {
$card_classes[] = '_info';
}

View File

@ -58,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -185,7 +185,7 @@ if ( $splide ) {
}
// Extra classes
$classes = [];
$classes = [ '_' . $args['post_status'] ];
if ( $is_sticky ) {
$classes[] = '_sticky';

View File

@ -58,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -168,6 +168,9 @@ if ( $splide ) {
$grid_or_vertical = $args['vertical'] ? '_vertical' : '_grid';
$card_classes = [];
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( $is_sticky ) {
$card_classes[] = '_sticky';
}

View File

@ -60,7 +60,7 @@ $card_counter = 0;
$query_args = array(
'fictioneer_query_name' => 'latest_updates_compact',
'post_type' => 'fcn_story',
'post_status' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => 'meta_value',
@ -182,7 +182,9 @@ if ( $splide ) {
continue;
}
// Extra classes
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}

View File

@ -63,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => 'meta_value',
@ -206,7 +206,7 @@ if ( $splide ) {
}
// Extra classes
$classes = [];
$classes = [ '_' . $args['post_status'] ];
if ( ! empty( $post->post_password ) ) {
$classes[] = '_password';

View File

@ -66,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' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => 'meta_value',
@ -187,7 +187,9 @@ if ( $splide ) {
continue;
}
// Extra classes
// Extra card classes
$card_classes[] = '_' . $args['post_status'];
if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}

View File

@ -47,7 +47,7 @@ $splide = $args['splide'] ?? 0;
$query_args = array (
'fictioneer_query_name' => 'showcase',
'post_type' => $args['post_type'],
'post_status' => $args['post_status'] ?? 'publish',
'post_status' => $args['post_status'],
'post__in' => $args['post_ids'], // May be empty!
'order' => $args['order'],
'orderby' => $args['orderby'],
@ -130,7 +130,7 @@ if ( $args['min_width'] ) {
}
// Classes
$classes = '';
$classes = '_' . $args['post_status'];
if ( $args['aspect_ratio'] ) {
$classes .= ' _aspect-ratio';