Add footer param to card shortcodes
This commit is contained in:
parent
8935606d0c
commit
e2b826ad69
@ -1001,6 +1001,7 @@ Renders a multi-column grid of small cards, showing the latest four chapters ord
|
||||
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).
|
||||
* **lightbox:** Whether clicking on the thumbnail/cover image opens the lightbox or post link. Default `true`.
|
||||
* **infobox:** Whether to show the info box and toggle on compact versions. Default `true`.
|
||||
* **footer:** Whether to show the footer (if any). Default `true`.
|
||||
* **footer_words:** Whether to show the chapter word count. Default `true`.
|
||||
* **footer_date:** Whether to show the chapter date. Default `true`.
|
||||
* **footer_comments:** Whether to show the chapter comment count. Default `true`.
|
||||
@ -1134,6 +1135,7 @@ Renders a multi-column grid of small cards, showing the latest four stories orde
|
||||
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).
|
||||
* **lightbox:** Whether clicking on the thumbnail/cover image opens the lightbox or post link. Default `true`.
|
||||
* **infobox:** Whether to show the info box and toggle on compact versions. Default `true`.
|
||||
* **footer:** Whether to show the footer (if any). Default `true`.
|
||||
* **footer_chapters:** Whether to show the chapter count. Default `true`.
|
||||
* **footer_words:** Whether to show the word count. Default `true`.
|
||||
* **footer_date:** Whether to show the date. Default `true`.
|
||||
@ -1196,6 +1198,7 @@ Renders a multi-column grid of small cards, showing the latest four updated stor
|
||||
* **aspect_ratio:** CSS [aspect-ratio](https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio) value for the image (X/Y; vertical only). Default `3/1`.
|
||||
* **words:** Whether to show the word count of chapter items. Default `true`.
|
||||
* **date:** Whether to show the date of chapter items. Default `true`.
|
||||
* **footer:** Whether to show the footer (if any). Default `true`.
|
||||
* **footer_chapters:** Whether to show the story chapter count. Default `true`.
|
||||
* **footer_words:** Whether to show the story word count. Default `true`.
|
||||
* **footer_date:** Whether to show the modified date. Default `true`.
|
||||
|
@ -25,6 +25,7 @@
|
||||
* @internal $args['relation'] Relationship between taxonomies. Default 'AND'.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_author'] Whether to show the post author. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the post date. Default true.
|
||||
* @internal $args['footer_comments'] Whether to show the post comment count. Default true.
|
||||
|
@ -30,6 +30,7 @@
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the chapter word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the chapter date. Default true.
|
||||
* @internal $args['footer_comments'] Whether to show the chapter comment count. Default true.
|
||||
@ -154,7 +155,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_' . get_theme_mod( 'card_style' );
|
||||
}
|
||||
|
||||
if ( $args['simple'] ) {
|
||||
if ( $args['simple'] || ! $args['footer'] ) {
|
||||
$card_classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
@ -290,7 +291,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( ! $args['simple'] ) : ?>
|
||||
<?php if ( ! $args['simple'] && $args['footer'] ) : ?>
|
||||
<div class="card__footer cell-footer _small">
|
||||
|
||||
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
||||
|
@ -167,6 +167,10 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_seamless';
|
||||
}
|
||||
|
||||
if ( ! $args['footer'] ) {
|
||||
$card_classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_chapters'] ) {
|
||||
$card_classes[] = '_no-footer-chapters';
|
||||
}
|
||||
@ -299,54 +303,56 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<div class="card__overlay-description _small"><?php echo $short_description; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card__footer _small">
|
||||
<?php if ( $args['footer'] ) : ?>
|
||||
<div class="card__footer _small">
|
||||
|
||||
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
||||
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
||||
|
||||
// Build footer items
|
||||
$footer_items = [];
|
||||
// Build footer items
|
||||
$footer_items = [];
|
||||
|
||||
if ( $args['footer_chapters'] && ( $story['status'] !== 'Oneshot' || $story['chapter_count'] > 1 ) ) {
|
||||
$footer_items['chapters'] = '<span class="card__footer-chapters"><i class="card-footer-icon fa-solid fa-list" title="' . esc_attr__( 'Chapters', 'fictioneer' ) . '"></i> ' . $story['chapter_count'] . '</span>';
|
||||
}
|
||||
|
||||
if ( $args['footer_words'] && ( $story['word_count'] > 2000 || $story['status'] === 'Oneshot' ) ) {
|
||||
$footer_items['words'] = '<span class="card__footer-words"><i class="card-footer-icon fa-solid fa-font" title="' . esc_attr__( 'Total Words', 'fictioneer' ) . '"></i> ' . $story['word_count_short'] . '</span>';
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
if ( $args['footer_chapters'] && ( $story['status'] !== 'Oneshot' || $story['chapter_count'] > 1 ) ) {
|
||||
$footer_items['chapters'] = '<span class="card__footer-chapters"><i class="card-footer-icon fa-solid fa-list" title="' . esc_attr__( 'Chapters', 'fictioneer' ) . '"></i> ' . $story['chapter_count'] . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $args['footer_status'] ) {
|
||||
$footer_items['status'] = '<span class="card__footer-status"><i class="card-footer-icon ' . $story['icon'] . '"></i> ' . fcntr( $story['status'] ) . '</span>';
|
||||
}
|
||||
if ( $args['footer_words'] && ( $story['word_count'] > 2000 || $story['status'] === 'Oneshot' ) ) {
|
||||
$footer_items['words'] = '<span class="card__footer-words"><i class="card-footer-icon fa-solid fa-font" title="' . esc_attr__( 'Total Words', 'fictioneer' ) . '"></i> ' . $story['word_count_short'] . '</span>';
|
||||
}
|
||||
|
||||
// Filter footer items
|
||||
$footer_items = apply_filters(
|
||||
'fictioneer_filter_shortcode_latest_stories_card_footer',
|
||||
$footer_items,
|
||||
$post,
|
||||
$story,
|
||||
$args
|
||||
);
|
||||
if ( $args['footer_date'] ) {
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode and render footer items
|
||||
echo implode( ' ', $footer_items );
|
||||
if ( $args['footer_status'] ) {
|
||||
$footer_items['status'] = '<span class="card__footer-status"><i class="card-footer-icon ' . $story['icon'] . '"></i> ' . fcntr( $story['status'] ) . '</span>';
|
||||
}
|
||||
|
||||
?></div>
|
||||
// Filter footer items
|
||||
$footer_items = apply_filters(
|
||||
'fictioneer_filter_shortcode_latest_stories_card_footer',
|
||||
$footer_items,
|
||||
$post,
|
||||
$story,
|
||||
$args
|
||||
);
|
||||
|
||||
<?php if ( $args['footer_rating'] ) : ?>
|
||||
<div class="card__footer-box _right rating-letter-label tooltipped" data-tooltip="<?php echo fcntr( $story['rating'], true ); ?>">
|
||||
<?php echo fcntr( $story['rating_letter'] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
// Implode and render footer items
|
||||
echo implode( ' ', $footer_items );
|
||||
|
||||
</div>
|
||||
?></div>
|
||||
|
||||
<?php if ( $args['footer_rating'] ) : ?>
|
||||
<div class="card__footer-box _right rating-letter-label tooltipped" data-tooltip="<?php echo fcntr( $story['rating'], true ); ?>">
|
||||
<?php echo fcntr( $story['rating_letter'] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -28,6 +28,7 @@
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_chapters'] Whether to show the chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the date. Default true.
|
||||
@ -152,6 +153,10 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_seamless';
|
||||
}
|
||||
|
||||
if ( ! $args['footer'] ) {
|
||||
$card_classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_chapters'] ) {
|
||||
$card_classes[] = '_no-footer-chapters';
|
||||
}
|
||||
@ -280,54 +285,56 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card__footer cell-footer _small">
|
||||
<?php if ( $args['footer'] ) : ?>
|
||||
<div class="card__footer cell-footer _small">
|
||||
|
||||
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
||||
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
||||
|
||||
// Build footer items
|
||||
$footer_items = [];
|
||||
// Build footer items
|
||||
$footer_items = [];
|
||||
|
||||
if ( $args['footer_chapters'] && ( $story['status'] !== 'Oneshot' || $story['chapter_count'] > 1 ) ) {
|
||||
$footer_items['chapters'] = '<span class="card__footer-chapters"><i class="card-footer-icon fa-solid fa-list" title="' . esc_attr__( 'Chapters', 'fictioneer' ) . '"></i> ' . $story['chapter_count'] . '</span>';
|
||||
}
|
||||
|
||||
if ( $args['footer_words'] && ( $story['word_count'] > 2000 || $story['status'] === 'Oneshot' ) ) {
|
||||
$footer_items['words'] = '<span class="card__footer-words"><i class="card-footer-icon fa-solid fa-font" title="' . esc_attr__( 'Total Words', 'fictioneer' ) . '"></i> ' . $story['word_count_short'] . '</span>';
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
if ( $args['footer_chapters'] && ( $story['status'] !== 'Oneshot' || $story['chapter_count'] > 1 ) ) {
|
||||
$footer_items['chapters'] = '<span class="card__footer-chapters"><i class="card-footer-icon fa-solid fa-list" title="' . esc_attr__( 'Chapters', 'fictioneer' ) . '"></i> ' . $story['chapter_count'] . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $args['footer_status'] ) {
|
||||
$footer_items['status'] = '<span class="card__footer-status"><i class="card-footer-icon ' . $story['icon'] . '"></i> ' . fcntr( $story['status'] ) . '</span>';
|
||||
}
|
||||
if ( $args['footer_words'] && ( $story['word_count'] > 2000 || $story['status'] === 'Oneshot' ) ) {
|
||||
$footer_items['words'] = '<span class="card__footer-words"><i class="card-footer-icon fa-solid fa-font" title="' . esc_attr__( 'Total Words', 'fictioneer' ) . '"></i> ' . $story['word_count_short'] . '</span>';
|
||||
}
|
||||
|
||||
// Filter footer items
|
||||
$footer_items = apply_filters(
|
||||
'fictioneer_filter_shortcode_latest_stories_card_footer',
|
||||
$footer_items,
|
||||
$post,
|
||||
$story,
|
||||
$args
|
||||
);
|
||||
if ( $args['footer_date'] ) {
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode and render footer items
|
||||
echo implode( ' ', $footer_items );
|
||||
if ( $args['footer_status'] ) {
|
||||
$footer_items['status'] = '<span class="card__footer-status"><i class="card-footer-icon ' . $story['icon'] . '"></i> ' . fcntr( $story['status'] ) . '</span>';
|
||||
}
|
||||
|
||||
?></div>
|
||||
// Filter footer items
|
||||
$footer_items = apply_filters(
|
||||
'fictioneer_filter_shortcode_latest_stories_card_footer',
|
||||
$footer_items,
|
||||
$post,
|
||||
$story,
|
||||
$args
|
||||
);
|
||||
|
||||
<?php if ( $args['footer_rating'] ) : ?>
|
||||
<div class="card__footer-box _right rating-letter-label tooltipped" data-tooltip="<?php echo fcntr( $story['rating'], true ); ?>">
|
||||
<?php echo fcntr( $story['rating_letter'] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
// Implode and render footer items
|
||||
echo implode( ' ', $footer_items );
|
||||
|
||||
</div>
|
||||
?></div>
|
||||
|
||||
<?php if ( $args['footer_rating'] ) : ?>
|
||||
<div class="card__footer-box _right rating-letter-label tooltipped" data-tooltip="<?php echo fcntr( $story['rating'], true ); ?>">
|
||||
<?php echo fcntr( $story['rating_letter'] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['words'] Whether to show the word count of chapter items. Default true.
|
||||
* @internal $args['date'] Whether to show the date of chapter items. Default true.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_chapters'] Whether to show the story chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the story word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the modified date. Default true.
|
||||
@ -156,7 +157,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_password';
|
||||
}
|
||||
|
||||
if ( in_array( $args['type'], ['simple', 'single'] ) ) {
|
||||
if ( ! $args['footer'] || in_array( $args['type'], ['simple', 'single'] ) ) {
|
||||
$card_classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
@ -401,7 +402,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! in_array( $args['type'], ['simple', 'single'] ) ) : ?>
|
||||
<?php if ( $args['footer'] && ! in_array( $args['type'], ['simple', 'single'] ) ) : ?>
|
||||
<div class="card__footer cell-footer _small">
|
||||
|
||||
<div class="card__footer-box _left text-overflow-ellipsis"><?php
|
||||
|
Loading…
x
Reference in New Issue
Block a user