Improve handling of list titles
This commit is contained in:
parent
e6cae22a6d
commit
c92f66da09
@ -986,6 +986,7 @@ if ( ! function_exists( 'fictioneer_get_chapter_list_items' ) ) {
|
||||
$classes = [];
|
||||
$title = trim( $post->post_title );
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $post->ID );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
$text_icon = fictioneer_get_field( 'fictioneer_chapter_text_icon', $post->ID );
|
||||
$parsed_url = wp_parse_url( home_url() );
|
||||
$relative_path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '';
|
||||
@ -1000,8 +1001,13 @@ if ( ! function_exists( 'fictioneer_get_chapter_list_items' ) ) {
|
||||
}
|
||||
|
||||
// CSS classes
|
||||
if ( $current_index == array_search( $post->ID, $data['chapter_ids'] ) ) $classes[] = 'current-chapter';
|
||||
if ( ! empty( $post->post_password ) ) $classes[] = 'has-password';
|
||||
if ( $current_index == array_search( $post->ID, $data['chapter_ids'] ) ) {
|
||||
$classes[] = 'current-chapter';
|
||||
}
|
||||
|
||||
if ( ! empty( $post->post_password ) ) {
|
||||
$classes[] = 'has-password';
|
||||
}
|
||||
|
||||
// Start HTML ---> ?>
|
||||
<li class="<?php echo implode( ' ', $classes ); ?>">
|
||||
@ -1011,7 +1017,7 @@ if ( ! function_exists( 'fictioneer_get_chapter_list_items' ) ) {
|
||||
<?php elseif ( ! $hide_icons ) : ?>
|
||||
<span class="text-icon"><?php echo $text_icon; ?></span>
|
||||
<?php endif; ?>
|
||||
<span><?php echo wp_strip_all_tags( $list_title ?: $title ); ?></span>
|
||||
<span><?php echo $list_title ?: $title; ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<?php // <--- End HTML
|
||||
|
@ -71,10 +71,13 @@ $show_type = $args['show_type'] ?? false;
|
||||
|
||||
<h3 class="card__title">
|
||||
<a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
$list_title = wp_strip_all_tags( fictioneer_get_field( 'fictioneer_chapter_list_title' ) );
|
||||
$list_title = trim( $list_title );
|
||||
|
||||
// Make sure there are no whitespaces in-between!
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_list_title' ) ) {
|
||||
echo '<span class="show-below-480">' . wp_strip_all_tags( fictioneer_get_field( 'fictioneer_chapter_list_title' ) ) . '</span>';
|
||||
echo '<span class="hide-below-480">' . $title . '</span>';
|
||||
if ( $list_title ) {
|
||||
echo "<span class='show-below-480'>{$list_title}</span>";
|
||||
echo "<span class='hide-below-480'>{$title}</span>";
|
||||
} else {
|
||||
echo $title;
|
||||
}
|
||||
|
@ -120,11 +120,12 @@ $is_sticky = FICTIONEER_ENABLE_STICKY_CARDS &&
|
||||
<i class="fa-solid fa-caret-right"></i>
|
||||
<a href="<?php the_permalink( $chapter->ID ); ?>" class="card__link-list-link"><?php
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $chapter->ID );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
echo fictioneer_get_safe_title( $chapter->ID );
|
||||
} else {
|
||||
echo wp_strip_all_tags( $list_title );
|
||||
echo $list_title;
|
||||
}
|
||||
?></a>
|
||||
</div>
|
||||
|
@ -152,7 +152,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
echo $list_title ? wp_strip_all_tags( $list_title ) : $title;
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
echo $list_title ? $list_title : $title;
|
||||
?></a></h3>
|
||||
|
||||
<div class="card__content _small cell-desc">
|
||||
|
@ -154,7 +154,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
echo $list_title ? wp_strip_all_tags( $list_title ) : $title;
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
echo $list_title ? $list_title : $title;
|
||||
?></a></h3>
|
||||
|
||||
<div class="card__content _small cell-desc">
|
||||
|
@ -177,11 +177,12 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php
|
||||
// Chapter title
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $chapter_id );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
$chapter_title = fictioneer_get_safe_title( $chapter_id );
|
||||
} else {
|
||||
$chapter_title = wp_strip_all_tags( $list_title );
|
||||
$chapter_title = $list_title;
|
||||
}
|
||||
|
||||
// Chapter excerpt
|
||||
|
@ -183,11 +183,12 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<a href="<?php the_permalink( $chapter_id ); ?>" class="card__link-list-link"><?php
|
||||
// Chapter title
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $chapter_id );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
echo fictioneer_get_safe_title( $chapter_id );
|
||||
} else {
|
||||
echo wp_strip_all_tags( $list_title );
|
||||
echo $list_title;
|
||||
}
|
||||
?></a>
|
||||
</div>
|
||||
|
@ -108,10 +108,10 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
// Get list title and story ID (if any)
|
||||
switch ( $args['post_type'] ) {
|
||||
case 'fcn_collection':
|
||||
$list_title = trim( fictioneer_get_field( 'fictioneer_collection_list_title' ) );
|
||||
$list_title = fictioneer_get_field( 'fictioneer_collection_list_title' );
|
||||
break;
|
||||
case 'fcn_chapter':
|
||||
$list_title = trim( fictioneer_get_field( 'fictioneer_chapter_list_title' ) );
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', get_the_ID() );
|
||||
|
||||
if ( empty( $landscape_image_id ) ) {
|
||||
@ -120,7 +120,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
break;
|
||||
}
|
||||
|
||||
// Prepare title
|
||||
// Prepare titles
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
$title = empty( $list_title ) ? fictioneer_get_safe_title( $post->ID ) : $list_title;
|
||||
|
||||
// Prepare image arguments
|
||||
|
@ -91,7 +91,9 @@ get_header( null, $header_args );
|
||||
if ( get_option( 'fictioneer_enable_bookmarks' ) ) {
|
||||
// Bookmark data
|
||||
$bookmark_story_title = '';
|
||||
$bookmark_title = fictioneer_get_field( 'fictioneer_chapter_list_title' ) ? fictioneer_get_field( 'fictioneer_chapter_list_title' ) : $title;
|
||||
$bookmark_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
$bookmark_title = trim( wp_strip_all_tags( $bookmark_title ) );
|
||||
$bookmark_title = $bookmark_title ?: $title;
|
||||
$bookmark_thumbnail = get_the_post_thumbnail_url( null, 'snippet' );
|
||||
$bookmark_image = get_the_post_thumbnail_url( null, 'full' );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user