Optimize chapter story column output

It's not much, but it's something.
This commit is contained in:
Tetrakern 2024-10-16 21:57:01 +02:00
parent b9b9a3b050
commit cfeed4201c

View File

@ -4813,9 +4813,14 @@ function fictioneer_manage_posts_column_chapter_story( $column_name, $post_id )
$column_name === 'fictioneer_chapter_story' &&
( $story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true ) )
) {
$title = fictioneer_truncate( fictioneer_get_safe_title( $story_id ), 64 );
static $titles = [];
echo '<a href="edit.php?post_type=fcn_chapter&filter_story=' . absint( $story_id ) . '">' . $title . '</a>';
if ( ! isset( $titles[ $story_id ] ) ) {
$titles[ $story_id ] = '<a href="edit.php?post_type=fcn_chapter&filter_story=' .
absint( $story_id ) . '">' . fictioneer_truncate( fictioneer_get_safe_title( $story_id ), 64 ) . '</a>';
}
echo $titles[ $story_id ];
}
}
add_action( 'manage_fcn_chapter_posts_custom_column', 'fictioneer_manage_posts_column_chapter_story', 10, 2 );