Improve chapter list title output
This commit is contained in:
parent
c99ed3ff50
commit
cd1585fe20
@ -1013,6 +1013,7 @@ function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
$text_icon = get_post_meta( $chapter_id, 'fictioneer_chapter_text_icon', true );
|
||||
$prefix = get_post_meta( $chapter_id, 'fictioneer_chapter_prefix', true );
|
||||
$title = fictioneer_get_safe_title( $chapter_id );
|
||||
$has_password = ! empty( $post->post_password );
|
||||
|
||||
// Start HTML ---> ?>
|
||||
<li class="chapter-group__list-item<?php echo $warning ? ' _warning' : ''; ?>" data-post-id="<?php echo $chapter_id; ?>">
|
||||
@ -1022,21 +1023,26 @@ function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
<i class="<?php echo empty( $icon ) ? 'fa-solid fa-book' : $icon; ?> chapter-group__list-item-icon"></i>
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="<?php the_permalink( $chapter_id ); ?>" class="chapter-group__list-item-link truncate _1-1">
|
||||
<?php
|
||||
if ( ! empty( $prefix ) ) {
|
||||
echo apply_filters( 'fictioneer_filter_list_chapter_prefix', $prefix ) . ' ';
|
||||
}
|
||||
echo $title;
|
||||
?>
|
||||
</a>
|
||||
<a
|
||||
href="<?php the_permalink( $chapter_id ); ?>"
|
||||
class="chapter-group__list-item-link truncate _1-1 <?php echo $has_password ? '_password' : ''; ?>"
|
||||
><?php
|
||||
|
||||
if ( ! empty( $prefix ) ) {
|
||||
// Mind space between prefix and title
|
||||
echo apply_filters( 'fictioneer_filter_list_chapter_prefix', $prefix ) . ' ';
|
||||
}
|
||||
|
||||
echo $title;
|
||||
|
||||
?></a>
|
||||
|
||||
<?php
|
||||
// Chapter subrow
|
||||
$chapter_data = [];
|
||||
$chapter_data['id'] = $chapter_id;
|
||||
$chapter_data['warning'] = $warning;
|
||||
$chapter_data['password'] = ! empty( $post->post_password );
|
||||
$chapter_data['password'] = $has_password;
|
||||
$chapter_data['timestamp'] = get_the_time( 'c' );
|
||||
$chapter_data['list_date'] = get_the_date( '' );
|
||||
$chapter_data['words'] = fictioneer_get_word_count( $chapter_id );
|
||||
|
@ -648,19 +648,24 @@ function fictioneer_story_chapters( $args ) {
|
||||
<a
|
||||
href="<?php echo $chapter['link']; ?>"
|
||||
class="chapter-group__list-item-link truncate _1-1 <?php echo $chapter['password'] ? '_password' : ''; ?>"
|
||||
>
|
||||
<?php
|
||||
if ( ! empty( $chapter['prefix'] ) ) {
|
||||
echo apply_filters( 'fictioneer_filter_list_chapter_prefix', $chapter['prefix'] );
|
||||
}
|
||||
?>
|
||||
<?php if ( ! empty( $chapter['list_title'] ) && $chapter['title'] !== $chapter['list_title'] ) : ?>
|
||||
<span class="chapter-group__list-item-title list-view"><?php echo $chapter['title']; ?></span>
|
||||
<span class="grid-view"><?php echo wp_strip_all_tags( $chapter['list_title'] ); ?></span>
|
||||
<?php else : ?>
|
||||
<?php echo $chapter['title']; ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
><?php
|
||||
|
||||
if ( ! empty( $chapter['prefix'] ) ) {
|
||||
// Mind space between prefix and title
|
||||
echo apply_filters( 'fictioneer_filter_list_chapter_prefix', $chapter['prefix'] ) . ' ';
|
||||
}
|
||||
|
||||
if ( ! empty( $chapter['list_title'] ) && $chapter['title'] !== $chapter['list_title'] ) {
|
||||
printf(
|
||||
' <span class="chapter-group__list-item-title list-view">%s</span><span class="grid-view">%s</span>',
|
||||
$chapter['title'],
|
||||
wp_strip_all_tags( $chapter['list_title'] )
|
||||
);
|
||||
} else {
|
||||
echo $chapter['title'];
|
||||
}
|
||||
|
||||
?></a>
|
||||
|
||||
<?php if ( $chapter['password'] ) : ?>
|
||||
<i class="fa-solid fa-lock icon-password grid-view"></i>
|
||||
|
Loading…
x
Reference in New Issue
Block a user