Add fictioneer_get_bullet_separator() helper
This commit is contained in:
parent
bdf31c400a
commit
bc3a3f657b
@ -2235,3 +2235,28 @@ function fictioneer_get_oauth2_login_links( $label = false, $classes = '', $anch
|
||||
// Return link sequence as HTML
|
||||
return $output;
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// BULLET SEPARATOR
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Returns the HTML of the bullet separator
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
* @since 5.23.0
|
||||
*
|
||||
* @param string|null $context Optional. The render context.
|
||||
*
|
||||
* @return string HTML of the bullet separator element. Default is three-per-em
|
||||
* spaces around a bullet ( • ).
|
||||
*/
|
||||
|
||||
function fictioneer_get_bullet_separator( $context = null ) {
|
||||
return apply_filters(
|
||||
'fictioneer_filter_bullet_separator',
|
||||
'<span class="separator-dot"> • </span>',
|
||||
$context
|
||||
);
|
||||
}
|
||||
|
@ -221,40 +221,40 @@ $pag_args = array(
|
||||
<div class="card__tag-list cell-tax _small _scrolling">
|
||||
<div class="card__h-scroll">
|
||||
<?php
|
||||
$output = [];
|
||||
$terms = [];
|
||||
|
||||
if ( $categories ) {
|
||||
foreach ( $categories as $cat ) {
|
||||
$output[] = '<a href="' . get_category_link( $cat ) . '" class="tag-pill _inline _category">' . get_category( $cat )->name . '</a>';
|
||||
$terms[] = '<a href="' . get_category_link( $cat ) . '" class="tag-pill _inline _category">' . get_category( $cat )->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $fandoms ) {
|
||||
foreach ( $fandoms as $fandom ) {
|
||||
$output[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $genres ) {
|
||||
foreach ( $genres as $genre ) {
|
||||
$output[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$output[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $characters ) {
|
||||
foreach ( $characters as $character ) {
|
||||
$output[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $output );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'latest-recommendations' ), $terms );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -220,8 +220,8 @@ $thumbnail_args = array(
|
||||
$characters ? fictioneer_generate_card_terms( $characters, '_inline _character' ) : []
|
||||
);
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $taxonomies );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'post-chapter' ), $taxonomies );
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -182,8 +182,8 @@ $thumbnail_args = array(
|
||||
$characters ? fictioneer_generate_card_terms( $characters, '_inline _character' ) : []
|
||||
);
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $taxonomies );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'post-collection' ), $taxonomies );
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -84,8 +84,8 @@ $thumbnail_args = array(
|
||||
$tags ? fictioneer_generate_card_terms( $tags, '_inline _tag' ) : []
|
||||
);
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $taxonomies );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'post-card' ), $taxonomies );
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -140,8 +140,8 @@ $thumbnail_args = array(
|
||||
$characters ? fictioneer_generate_card_terms( $characters, '_inline _character' ) : []
|
||||
);
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $taxonomies );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'post-recommendation' ), $taxonomies );
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -224,8 +224,8 @@ if ( $card_cache_active ) {
|
||||
$story['characters'] ? fictioneer_generate_card_terms( $story['characters'], '_inline _character' ) : []
|
||||
);
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $taxonomies );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'post-story' ), $taxonomies );
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -204,34 +204,34 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<div class="card__tag-list _small">
|
||||
<?php
|
||||
if ( $fandoms || $characters || $genres || $tags ) {
|
||||
$output = [];
|
||||
$terms = [];
|
||||
|
||||
if ( $fandoms ) {
|
||||
foreach ( $fandoms as $fandom ) {
|
||||
$output[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $genres ) {
|
||||
foreach ( $genres as $genre ) {
|
||||
$output[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$output[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $characters ) {
|
||||
foreach ( $characters as $character ) {
|
||||
$output[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $output );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'latest-recommendations' ), $terms );
|
||||
} else {
|
||||
?><span class="card__no-taxonomies"><?php _e( 'No taxonomies specified yet.', 'fictioneer' ); ?></span><?php
|
||||
}
|
||||
|
@ -220,34 +220,34 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<div class="card__h-scroll">
|
||||
<?php
|
||||
if ( $fandoms || $characters || $genres || $tags ) {
|
||||
$output = [];
|
||||
$terms = [];
|
||||
|
||||
if ( $fandoms ) {
|
||||
foreach ( $fandoms as $fandom ) {
|
||||
$output[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $genres ) {
|
||||
foreach ( $genres as $genre ) {
|
||||
$output[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$output[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $characters ) {
|
||||
foreach ( $characters as $character ) {
|
||||
$output[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $output );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'latest-recommendations' ), $terms );
|
||||
} else {
|
||||
?><span class="card__no-taxonomies"><?php _e( 'No taxonomies specified yet.', 'fictioneer' ); ?></span><?php
|
||||
}
|
||||
|
@ -266,34 +266,34 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<div class="card__tag-list _small">
|
||||
<?php
|
||||
if ( $story['has_taxonomies'] || $tags ) {
|
||||
$output = [];
|
||||
$terms = [];
|
||||
|
||||
if ( $story['fandoms'] ) {
|
||||
foreach ( $story['fandoms'] as $fandom ) {
|
||||
$output[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['genres'] ) {
|
||||
foreach ( $story['genres'] as $genre ) {
|
||||
$output[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$output[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['characters'] ) {
|
||||
foreach ( $story['characters'] as $character ) {
|
||||
$output[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $output );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'latest-recommendations' ), $terms );
|
||||
} else {
|
||||
?><span class="card__no-taxonomies"><?php _e( 'No taxonomies specified yet.', 'fictioneer' ); ?></span><?php
|
||||
}
|
||||
|
@ -250,34 +250,36 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<div class="card__h-scroll">
|
||||
<?php
|
||||
if ( $story['has_taxonomies'] || $tags ) {
|
||||
$output = [];
|
||||
$terms = [];
|
||||
|
||||
if ( $story['fandoms'] ) {
|
||||
foreach ( $story['fandoms'] as $fandom ) {
|
||||
$output[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['genres'] ) {
|
||||
foreach ( $story['genres'] as $genre ) {
|
||||
$output[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$output[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['characters'] ) {
|
||||
foreach ( $story['characters'] as $character ) {
|
||||
$output[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
$terms[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $output );
|
||||
$terms = apply_filters( 'fictioneer_filter_shortcode_latest_stories_terms', $terms, $story, $args );
|
||||
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'latest-stories' ), $terms );
|
||||
} else {
|
||||
?><span class="card__no-taxonomies"><?php _e( 'No taxonomies specified yet.', 'fictioneer' ); ?></span><?php
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
if ( $words && $args['date'] ) {
|
||||
echo '<span class="separator-dot"> • </span>';
|
||||
echo fictioneer_get_bullet_separator( 'latest-updates-compact' );
|
||||
}
|
||||
|
||||
if ( $args['date'] ) {
|
||||
|
@ -401,8 +401,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
$terms = apply_filters( 'fictioneer_filter_shortcode_latest_updates_terms', $terms, $story, $args );
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $terms );
|
||||
// Implode with separator
|
||||
echo implode( fictioneer_get_bullet_separator( 'latest-updates' ), $terms );
|
||||
} else {
|
||||
?><span class="card__no-taxonomies"><?php _e( 'No taxonomies specified yet.', 'fictioneer' ); ?></span><?php
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user