diff --git a/functions.php b/functions.php index 4141aa9..d23fe81 100644 --- a/functions.php +++ b/functions.php @@ -56,9 +56,19 @@ function kjweji_register_tucao() { 'supports' => array('title', 'editor', 'author', 'thumbnail', 'comments'), 'menu_position' => 25, 'menu_icon' => 'dashicons-format-chat', + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'comments'), )); } +// 主题激活时,把已存在的 tucao 文章全部开放评论 +add_action('after_switch_theme', 'kjweji_open_tucao_comments'); +function kjweji_open_tucao_comments() { + $posts = get_posts(array('post_type' => 'tucao', 'posts_per_page' => -1, 'post_status' => 'any')); + foreach ($posts as $post) { + wp_update_post(array('ID' => $post->ID, 'comment_status' => 'open')); + } +} + // ── 摘要取前 2-3 句 ─────────────────────────── // 摘要:取文章内容的前 N 个字符(在句号处截断) function kjweji_excerpt($max_sentences = 5, $max_chars = 300) { diff --git a/style.css b/style.css index 6d97bc0..08749d3 100644 --- a/style.css +++ b/style.css @@ -1,6 +1,6 @@ /* Theme Name: 空笺未寄 -Version: 0.14.3 +Version: 0.14.4 Requires at least: 6.0 Requires PHP: 7.4 License: MIT