Skip to content

Commit

Permalink
fix: toc display exception (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
seatonjiang committed Jan 14, 2023
1 parent 29366cb commit f170b64
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions inc/theme-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 侧栏小工具
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.11.27
* @version 2023.01.14
*/

// 添加小工具
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -610,8 +611,8 @@ public function widget($args, $instance)
for ($i = 0; $i <= $to_depth; $i++) {
$index .= '</li>' . "\n" . '</ul>' . "\n";
}
wp_cache_set(get_the_ID(), $index, 'toc', 360000);
$index = '<div class="widget w-toc">' . "\n" . '<div class="title">文章目录</div>' . "\n" . '<div class="item">' . $index . '</div>' . "\n" . '</div>';
wp_cache_set(get_the_ID(), $index, 'toc', 360000);
}

echo $index;
Expand Down

0 comments on commit f170b64

Please sign in to comment.