diff --git a/inc/theme-options.php b/inc/theme-options.php index 4d333a2..e827589 100644 --- a/inc/theme-options.php +++ b/inc/theme-options.php @@ -139,6 +139,20 @@ if (!function_exists('yang_opt_default_custom_css')) { function kratos_options() { + /* 🔴 让 desc 里的链接能新窗口打开。 + 框架渲染 desc 时走 wp_kses($explain_value, $allowedtags) + (inc/options-framework/includes/class-options-interface.php:210/315), + 而 WordPress 的全局 $allowedtags['a'] 只有 href + title —— + **target / rel 会被静默剥掉**,代码里写着 target="_blank" 也不生效。 + 实测:wp_kses 输出里 target 消失,页面点链接在本页跳走。 + 在构建选项数组时补齐白名单(只补这两个属性,不放宽别的)。 */ + global $allowedtags; + if (!isset($allowedtags['a']) || !is_array($allowedtags['a'])) { + $allowedtags['a'] = array(); + } + $allowedtags['a']['target'] = true; + $allowedtags['a']['rel'] = true; + $sitename = get_bloginfo('name'); $imagepath = ASSET_PATH . '/assets/img/options/'; diff --git a/style.css b/style.css index 939b5ac..4d2ff57 100644 --- a/style.css +++ b/style.css @@ -1,7 +1,7 @@ /* Theme Name: Kratos_Yang Text Domain: kratos_Yang -Version: 4.1.0 +Version: 4.1.1 Requires PHP: 7.0 Description: 这是一个Kratos主题的分支版本,用来增加一些定制化功能。 Tags: 博客, 双栏, 响应式, 自定义背景, 自定义颜色, 自定义图标, 自定义菜单, 特色图像, 收录优化, 邮件中心, 主题选项, 小工具, 文章置顶, 无障碍友好