From f170b6468822fc38945632c22a40781d419426f1 Mon Sep 17 00:00:00 2001 From: Seaton Jiang Date: Sat, 14 Jan 2023 09:59:06 +0800 Subject: [PATCH] fix: toc display exception (#562) --- inc/theme-widgets.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/theme-widgets.php b/inc/theme-widgets.php index 482501c..34d1c3d 100644 --- a/inc/theme-widgets.php +++ b/inc/theme-widgets.php @@ -4,7 +4,7 @@ * 侧栏小工具 * @author Seaton Jiang * @license GPL-3.0 License - * @version 2022.11.27 + * @version 2023.01.14 */ // 添加小工具 @@ -38,7 +38,8 @@ function widgets_init() add_action('widgets_init', 'widgets_init'); // 关闭默认小工具 -function widget_unregister() { +function widget_unregister() +{ // fix #502 #521 // unregister_widget('WP_Widget_Block'); unregister_widget('WP_Widget_Pages'); @@ -610,8 +611,8 @@ class widget_toc extends WP_Widget for ($i = 0; $i <= $to_depth; $i++) { $index .= '' . "\n" . '' . "\n"; } - wp_cache_set(get_the_ID(), $index, 'toc', 360000); $index = '
' . "\n" . '
文章目录
' . "\n" . '
' . $index . '
' . "\n" . '
'; + wp_cache_set(get_the_ID(), $index, 'toc', 360000); } echo $index;