Add more CSS modifier classes to small cards

This commit is contained in:
Tetrakern 2024-02-06 03:10:02 +01:00
parent f40cb3242f
commit c55c737dbd
6 changed files with 54 additions and 6 deletions

View File

@ -129,6 +129,12 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
$title = fictioneer_get_safe_title( $post->ID );
$story = $story_id ? fictioneer_get_story_data( $story_id, false ) : null; // Does not refresh comment count!
$text_icon = get_post_meta( $post->ID, 'fictioneer_chapter_text_icon', true );
$extra_classes = [];
// Extra card classes
if ( ! empty( $post->post_password ) ) {
$extra_classes[] = '_password';
}
// Chapter images
$thumbnail_full = get_the_post_thumbnail_url( $post, 'full' );
@ -146,7 +152,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
}
?>
<li class="card watch-last-clicked _small _info">
<li class="card watch-last-clicked _small _info <?php echo implode( ' ', $extra_classes ); ?>">
<div class="card__body polygon">
<button class="card__info-toggle toggle-last-clicked" aria-label="<?php esc_attr_e( 'Open info box', 'fictioneer' ); ?>"><i class="fa-solid fa-chevron-down"></i></button>

View File

@ -131,6 +131,12 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
$chapter_rating = get_post_meta( $post->ID, 'fictioneer_chapter_rating', true );
$story = $story_id ? fictioneer_get_story_data( $story_id, false ) : null; // Does not refresh comment count!
$text_icon = get_post_meta( $post->ID, 'fictioneer_chapter_text_icon', true );
$extra_classes = [];
// Extra card classes
if ( ! empty( $post->post_password ) ) {
$extra_classes[] = '_password';
}
// Chapter images
$thumbnail_full = get_the_post_thumbnail_url( $post, 'full' );
@ -148,7 +154,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
}
?>
<li class="card _small">
<li class="card _small <?php echo implode( ' ', $extra_classes ); ?>">
<div class="card__body polygon">
<div class="card__main _grid _small">

View File

@ -120,9 +120,23 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
// Setup
$story = fictioneer_get_story_data( $post->ID, false ); // Does not refresh comment count!
$tags = get_option( 'fictioneer_show_tags_on_story_cards' ) ? get_the_tags( $post ) : false;
$is_sticky = FICTIONEER_ENABLE_STICKY_CARDS && get_post_meta( $post->ID, 'fictioneer_story_sticky', true );
$extra_classes = [];
if ( $show_taxonomies ) {
$extra_classes[] = '_info';
}
if ( $is_sticky ) {
$extra_classes[] = '_sticky';
}
if ( ! empty( $post->post_password ) ) {
$extra_classes[] = '_password';
}
?>
<li class="card watch-last-clicked _small <?php echo $show_taxonomies ? '_info' : ''; ?>">
<li class="card watch-last-clicked _small <?php echo implode( ' ', $extra_classes ); ?>">
<div class="card__body polygon">
<?php if ( $show_taxonomies ) : ?>

View File

@ -117,9 +117,19 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
// Setup
$story = fictioneer_get_story_data( $post->ID, false ); // Does not refresh comment count!
$tags = get_option( 'fictioneer_show_tags_on_story_cards' ) ? get_the_tags( $post ) : false;
$is_sticky = FICTIONEER_ENABLE_STICKY_CARDS && get_post_meta( $post->ID, 'fictioneer_story_sticky', true );
$extra_classes = [];
if ( $is_sticky ) {
$extra_classes[] = '_sticky';
}
if ( ! empty( $post->post_password ) ) {
$extra_classes[] = '_password';
}
?>
<li class="card _small">
<li class="card _small <?php echo implode( ' ', $extra_classes ); ?>">
<div class="card__body polygon">
<div class="card__main _grid _small">

View File

@ -130,12 +130,18 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
$chapter_list = [];
$chapter_excerpt; // Set inside inner loop
$chapter_title; // Set inside inner loop
$extra_classes = [];
// Skip if no chapters
if ( $story['chapter_count'] < 1 ) {
continue;
}
// Extra card classes
if ( ! empty( $post->post_password ) ) {
$extra_classes[] = '_password';
}
// Search for viable chapters...
$search_list = array_reverse( $story['chapter_ids'] );
@ -159,7 +165,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
}
?>
<li class="card watch-last-clicked _small _info">
<li class="card watch-last-clicked _small _info <?php echo implode( ' ', $extra_classes ); ?>">
<div class="card__body polygon">
<button class="card__info-toggle toggle-last-clicked" aria-label="<?php esc_attr_e( 'Open info box', 'fictioneer' ); ?>"><i class="fa-solid fa-chevron-down"></i></button>

View File

@ -130,12 +130,18 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
$story = fictioneer_get_story_data( $post->ID, false ); // Does not refresh comment count!
$tags = get_option( 'fictioneer_show_tags_on_story_cards' ) ? get_the_tags( $post ) : false;
$chapter_list = [];
$extra_classes = [];
// Skip if no chapters
if ( $story['chapter_count'] < 1 ) {
continue;
}
// Extra card classes
if ( ! empty( $post->post_password ) ) {
$extra_classes[] = '_password';
}
// Search for viable chapters...
$search_list = array_reverse( $story['chapter_ids'] );
@ -162,7 +168,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
}
?>
<li class="card _small">
<li class="card _small <?php echo implode( ' ', $extra_classes ); ?>">
<div class="card__body polygon">
<div class="card__main _grid _small">