Add new variants to Latest Updates shortcodes
This commit is contained in:
parent
2a85928edc
commit
25ac9b4027
@ -23,6 +23,9 @@
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Only with vertical.
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
?>
|
||||
@ -127,6 +130,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php
|
||||
// Setup
|
||||
$story = fictioneer_get_story_data( $post->ID, false ); // Does not refresh comment count!
|
||||
$grid_or_vertical = $args['vertical'] ? '_vertical' : '_grid';
|
||||
$chapter_list = [];
|
||||
$chapter_excerpt; // Set inside inner loop
|
||||
$chapter_title; // Set inside inner loop
|
||||
@ -146,6 +150,10 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_' . get_theme_mod( 'card_style' );
|
||||
}
|
||||
|
||||
if ( $args['vertical'] && $args['seamless'] ) {
|
||||
$card_classes[] = '_seamless';
|
||||
}
|
||||
|
||||
// Search for viable chapters...
|
||||
$search_list = array_reverse( $story['chapter_ids'] );
|
||||
|
||||
@ -171,7 +179,14 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
// Card attributes
|
||||
$attributes = apply_filters( 'fictioneer_filter_card_attributes', [], $post, 'shortcode-latest-updates-compact' );
|
||||
$attributes = [];
|
||||
|
||||
if ( $args['aspect_ratio'] ) {
|
||||
$attributes['style'] = '--card-image-aspect-ratio: ' . $args['aspect_ratio'];
|
||||
}
|
||||
|
||||
$attributes = apply_filters( 'fictioneer_filter_card_attributes', $attributes, $post, 'shortcode-latest-updates-compact' );
|
||||
|
||||
$card_attributes = '';
|
||||
|
||||
foreach ( $attributes as $key => $value ) {
|
||||
@ -190,12 +205,14 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<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>
|
||||
|
||||
<div class="card__main _grid _small">
|
||||
<div class="card__main <?php echo $grid_or_vertical; ?> _small">
|
||||
|
||||
<?php do_action( 'fictioneer_shortcode_latest_updates_card_body', $post, $story, $args ); ?>
|
||||
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $story['title'] ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>><?php echo get_the_post_thumbnail( $post, 'snippet', $thumbnail_args ); ?></a>
|
||||
<?php elseif ( $args['vertical'] ) : ?>
|
||||
<a href="<?php the_permalink(); ?>" class='card__image cell-img _default'></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
|
@ -25,6 +25,9 @@
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['simple'] Whether to show the simple variant.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Only with vertical.
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
?>
|
||||
@ -129,6 +132,7 @@ 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;
|
||||
$grid_or_vertical = $args['vertical'] ? '_vertical' : '_grid';
|
||||
$chapter_list = [];
|
||||
$card_classes = [];
|
||||
|
||||
@ -146,6 +150,10 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_' . get_theme_mod( 'card_style' );
|
||||
}
|
||||
|
||||
if ( $args['vertical'] && $args['seamless'] ) {
|
||||
$card_classes[] = '_seamless';
|
||||
}
|
||||
|
||||
// Search for viable chapters...
|
||||
$search_list = array_reverse( $story['chapter_ids'] );
|
||||
|
||||
@ -174,7 +182,14 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
// Card attributes
|
||||
$attributes = apply_filters( 'fictioneer_filter_card_attributes', [], $post, 'shortcode-latest-updates' );
|
||||
$attributes = [];
|
||||
|
||||
if ( $args['aspect_ratio'] ) {
|
||||
$attributes['style'] = '--card-image-aspect-ratio: ' . $args['aspect_ratio'];
|
||||
}
|
||||
|
||||
$attributes = apply_filters( 'fictioneer_filter_card_attributes', $attributes, $post, 'shortcode-latest-updates' );
|
||||
|
||||
$card_attributes = '';
|
||||
|
||||
foreach ( $attributes as $key => $value ) {
|
||||
@ -191,12 +206,14 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<li class="card _small _story-update <?php echo implode( ' ', $card_classes ); ?>" <?php echo $card_attributes; ?>>
|
||||
<div class="card__body polygon">
|
||||
|
||||
<div class="card__main _grid _small">
|
||||
<div class="card__main <?php echo $grid_or_vertical; ?> _small">
|
||||
|
||||
<?php do_action( 'fictioneer_shortcode_latest_updates_card_body', $post, $story, $args ); ?>
|
||||
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $story['title'] ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>><?php echo get_the_post_thumbnail( $post, 'snippet', $thumbnail_args ); ?></a>
|
||||
<?php elseif ( $args['vertical'] ) : ?>
|
||||
<a href="<?php the_permalink(); ?>" class='card__image cell-img _default'></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
|
Loading…
x
Reference in New Issue
Block a user