Add protected icon to (some) cards

This commit is contained in:
Tetrakern 2024-01-18 21:44:29 +01:00
parent 9b465bbaca
commit 562b6c5816
8 changed files with 47 additions and 5 deletions

View File

@ -74,6 +74,10 @@ $show_type = $args['show_type'] ?? false;
$list_title = wp_strip_all_tags( get_post_meta( $post->ID, 'fictioneer_chapter_list_title', true ) );
$list_title = trim( $list_title );
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
// Make sure there are no whitespaces in-between!
if ( $list_title ) {
echo "<span class='show-below-480'>{$list_title}</span>";

View File

@ -61,7 +61,13 @@ $is_sticky = FICTIONEER_ENABLE_STICKY_CARDS &&
<div class="card__label"><?php _ex( 'Story', 'Story card label.', 'fictioneer' ); ?></div>
<?php endif; ?>
<h3 class="card__title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php echo $story['title']; ?></a></h3>
<h3 class="card__title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
echo $story['title'];
?></a></h3>
<?php if ( $is_sticky ) : ?>
<div class="card__sticky-icon" title="<?php echo esc_attr__( 'Sticky', 'fictioneer' ); ?>"><i class="fa-solid fa-thumbtack"></i></div>

View File

@ -156,6 +156,10 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
$list_title = get_post_meta( $post->ID, 'fictioneer_chapter_list_title', true );
$list_title = trim( wp_strip_all_tags( $list_title ) );
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
echo $list_title ? $list_title : $title;
?></a></h3>

View File

@ -156,6 +156,10 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
$list_title = get_post_meta( $post->ID, 'fictioneer_chapter_list_title', true );
$list_title = trim( wp_strip_all_tags( $list_title ) );
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
echo $list_title ? $list_title : $title;
?></a></h3>

View File

@ -129,7 +129,13 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
</a>
<?php endif; ?>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php echo $story['title']; ?></a></h3>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
echo $story['title'];
?></a></h3>
<div class="card__content _small cell-desc truncate _3-3">
<?php if ( get_option( 'fictioneer_show_authors' ) ) : ?>

View File

@ -122,7 +122,13 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
</a>
<?php endif; ?>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php echo $story['title']; ?></a></h3>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
echo $story['title'];
?></a></h3>
<div class="card__content _small cell-desc truncate _3-3">
<?php if ( get_option( 'fictioneer_show_authors' ) ) : ?>

View File

@ -157,7 +157,13 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<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', ['class' => 'no-auto-lightbox'] ); ?></a>
<?php endif; ?>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php echo $story['title']; ?></a></h3>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
echo $story['title'];
?></a></h3>
<div class="card__content _small cell-desc truncate _1-1">
<?php if ( get_option( 'fictioneer_show_authors' ) ) : ?>

View File

@ -158,7 +158,13 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<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', ['class' => 'no-auto-lightbox'] ); ?></a>
<?php endif; ?>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php echo $story['title']; ?></a></h3>
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
if ( ! empty( $post->post_password ) ) {
echo '<i class="fa-solid fa-lock protected-icon"></i> ';
}
echo $story['title'];
?></a></h3>
<div class="card__content _small cell-desc">
<div class="truncate <?php echo count( $chapter_list ) > 1 ? '_1-1' : '_2-2'; ?>">