From cfeed4201c0479e0ebf4782033f0b54daef99b8c Mon Sep 17 00:00:00 2001
From: Tetrakern <26898880+Tetrakern@users.noreply.github.com>
Date: Wed, 16 Oct 2024 21:57:01 +0200
Subject: [PATCH] Optimize chapter story column output
It's not much, but it's something.
---
includes/functions/_setup-meta-fields.php | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/includes/functions/_setup-meta-fields.php b/includes/functions/_setup-meta-fields.php
index 44f77223..28e74bf1 100644
--- a/includes/functions/_setup-meta-fields.php
+++ b/includes/functions/_setup-meta-fields.php
@@ -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 '' . $title . '';
+ if ( ! isset( $titles[ $story_id ] ) ) {
+ $titles[ $story_id ] = '' . fictioneer_truncate( fictioneer_get_safe_title( $story_id ), 64 ) . '';
+ }
+
+ echo $titles[ $story_id ];
}
}
add_action( 'manage_fcn_chapter_posts_custom_column', 'fictioneer_manage_posts_column_chapter_story', 10, 2 );