Skip to content

Commit

Permalink
Add post status CSS to shortcode outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetrakern committed Jan 12, 2025
1 parent d614b97 commit 9360506
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 23 deletions.
4 changes: 3 additions & 1 deletion partials/_article-cards.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 51,7 @@
$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'],
Expand Down Expand Up @@ -176,6 176,8 @@
}

// Extra classes
$card_classes[] = '_' . $args['post_status'];

if ( get_theme_mod( 'card_style', 'default' ) !== 'default' ) {
$card_classes[] = '_' . get_theme_mod( 'card_style' );
}
Expand Down
4 changes: 3 additions & 1 deletion partials/_latest-chapters-compact.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 52,7 @@
$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'],
Expand Down Expand Up @@ -169,6 169,8 @@
$card_classes = [];

// Extra card classes
$card_classes[] = '_' . $args['post_status'];

if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}
Expand Down
4 changes: 2 additions & 2 deletions partials/_latest-chapters-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 57,7 @@
$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'],
Expand Down Expand Up @@ -201,7 201,7 @@
}

// Extra classes
$classes = [];
$classes = [ '_' . $args['post_status'] ];

if ( ! empty( $post->post_password ) ) {
$classes[] = '_password';
Expand Down
4 changes: 3 additions & 1 deletion partials/_latest-chapters.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 57,7 @@
$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'],
Expand Down Expand Up @@ -178,6 178,8 @@
}

// Extra card classes
$card_classes[] = '_' . $args['post_status'];

if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}
Expand Down
5 changes: 4 additions & 1 deletion partials/_latest-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 33,7 @@
$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',
Expand Down Expand Up @@ -89,6 89,9 @@
// Query post
$latest_entries = fictioneer_shortcode_query( $query_args );

// Classes
$args['classes'] .= ' _' . $args['post_status'];

?>

<section class="latest-posts <?php echo $args['classes']; ?>">
Expand Down
6 changes: 4 additions & 2 deletions partials/_latest-recommendations-compact.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 49,7 @@
$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'],
Expand Down Expand Up @@ -144,7 144,9 @@
$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';
}
Expand Down
6 changes: 4 additions & 2 deletions partials/_latest-recommendations.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 47,7 @@
$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'],
Expand Down Expand Up @@ -141,7 141,9 @@
$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' );
}
Expand Down
6 changes: 4 additions & 2 deletions partials/_latest-stories-compact.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 57,7 @@
$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'],
Expand Down Expand Up @@ -172,7 172,9 @@
);
$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';
}
Expand Down
4 changes: 2 additions & 2 deletions partials/_latest-stories-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 58,7 @@
$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'],
Expand Down Expand Up @@ -185,7 185,7 @@
}

// Extra classes
$classes = [];
$classes = [ '_' . $args['post_status'] ];

if ( $is_sticky ) {
$classes[] = '_sticky';
Expand Down
5 changes: 4 additions & 1 deletion partials/_latest-stories.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 58,7 @@
$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'],
Expand Down Expand Up @@ -168,6 168,9 @@
$grid_or_vertical = $args['vertical'] ? '_vertical' : '_grid';
$card_classes = [];

// Extra card classes
$card_classes[] = '_' . $args['post_status'];

if ( $is_sticky ) {
$card_classes[] = '_sticky';
}
Expand Down
6 changes: 4 additions & 2 deletions partials/_latest-updates-compact.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 60,7 @@
$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',
Expand Down Expand Up @@ -182,7 182,9 @@
continue;
}

// Extra classes
// Extra card classes
$card_classes[] = '_' . $args['post_status'];

if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}
Expand Down
4 changes: 2 additions & 2 deletions partials/_latest-updates-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 63,7 @@
$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',
Expand Down Expand Up @@ -206,7 206,7 @@
}

// Extra classes
$classes = [];
$classes = [ '_' . $args['post_status'] ];

if ( ! empty( $post->post_password ) ) {
$classes[] = '_password';
Expand Down
6 changes: 4 additions & 2 deletions partials/_latest-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 66,7 @@
$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',
Expand Down Expand Up @@ -187,7 187,9 @@
continue;
}

// Extra classes
// Extra card classes
$card_classes[] = '_' . $args['post_status'];

if ( ! empty( $post->post_password ) ) {
$card_classes[] = '_password';
}
Expand Down
4 changes: 2 additions & 2 deletions partials/_showcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 47,7 @@
$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'],
Expand Down Expand Up @@ -130,7 130,7 @@
}

// Classes
$classes = '';
$classes = '_' . $args['post_status'];

if ( $args['aspect_ratio'] ) {
$classes .= ' _aspect-ratio';
Expand Down

0 comments on commit 9360506

Please sign in to comment.