v1.13 — Customizer 可配置化
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
</div><!-- .main-content -->
|
</div><!-- .main-content -->
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<p class="motto">空笺待写千般意,未寄先存一寸心</p>
|
<p class="motto"><?php echo esc_html(get_theme_mod('kjweji_footer_motto', '空笺待写千般意,未寄先存一寸心')); ?></p>
|
||||||
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?> · 每一段文字,都在时光里等待回音</p>
|
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?> · <?php echo esc_html(get_theme_mod('kjweji_footer_text', '每一段文字,都在时光里等待回音')); ?></p>
|
||||||
</footer>
|
</footer>
|
||||||
</div><!-- .platform -->
|
</div><!-- .platform -->
|
||||||
</div><!-- .site -->
|
</div><!-- .site -->
|
||||||
|
|||||||
@@ -282,6 +282,95 @@ add_filter('comment_form_defaults', function($defaults) {
|
|||||||
return $defaults;
|
return $defaults;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ── Customizer(外观 → 自定义 → 空笺未寄设置) ────
|
||||||
|
add_action('customize_register', 'kjweji_customize_register');
|
||||||
|
function kjweji_customize_register($wp_customize) {
|
||||||
|
// 注册 section
|
||||||
|
$wp_customize->add_section('kjweji_settings', array(
|
||||||
|
'title' => '空笺未寄设置',
|
||||||
|
'priority' => 30,
|
||||||
|
));
|
||||||
|
|
||||||
|
// ── 首页 ──
|
||||||
|
$wp_customize->add_setting('kjweji_hero_intro', array(
|
||||||
|
'default' => "这里是自白者的栖息地。\n吐槽,落笔,沉思,接住那一缕若有的情绪。\n片语只言,皆是存在。",
|
||||||
|
'sanitize_callback' => 'sanitize_textarea_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_hero_intro', array(
|
||||||
|
'label' => '首页介绍文字',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'textarea',
|
||||||
|
));
|
||||||
|
|
||||||
|
$wp_customize->add_setting('kjweji_hero_couplet', array(
|
||||||
|
'default' => '空笺待写千般意,未寄先存一寸心',
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_hero_couplet', array(
|
||||||
|
'label' => '首页对联',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'text',
|
||||||
|
));
|
||||||
|
|
||||||
|
$wp_customize->add_setting('kjweji_hero_couplet_hl1', array(
|
||||||
|
'default' => '千般意',
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_hero_couplet_hl1', array(
|
||||||
|
'label' => '对联高亮词1',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'text',
|
||||||
|
));
|
||||||
|
|
||||||
|
$wp_customize->add_setting('kjweji_hero_couplet_hl2', array(
|
||||||
|
'default' => '一寸心',
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_hero_couplet_hl2', array(
|
||||||
|
'label' => '对联高亮词2',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'text',
|
||||||
|
));
|
||||||
|
|
||||||
|
// ── 页脚 ──
|
||||||
|
$wp_customize->add_setting('kjweji_footer_motto', array(
|
||||||
|
'default' => '空笺待写千般意,未寄先存一寸心',
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_footer_motto', array(
|
||||||
|
'label' => '页脚格言',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'text',
|
||||||
|
));
|
||||||
|
|
||||||
|
$wp_customize->add_setting('kjweji_footer_text', array(
|
||||||
|
'default' => '每一段文字,都在时光里等待回音',
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_footer_text', array(
|
||||||
|
'label' => '页脚版权文案',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'text',
|
||||||
|
));
|
||||||
|
|
||||||
|
// ── 页面副标题 ──
|
||||||
|
$wp_customize->add_setting('kjweji_articles_subtitle', array(
|
||||||
|
'default' => '字里行间,尽是岁月',
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_articles_subtitle', array(
|
||||||
|
'label' => '笺文页副标题',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'text',
|
||||||
|
));
|
||||||
|
|
||||||
|
$wp_customize->add_setting('kjweji_photos_subtitle', array(
|
||||||
|
'default' => '在时光里截图',
|
||||||
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
|
));
|
||||||
|
$wp_customize->add_control('kjweji_photos_subtitle', array(
|
||||||
|
'label' => '拾影页副标题',
|
||||||
|
'section' => 'kjweji_settings',
|
||||||
|
'type' => 'text',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,11 +4,16 @@
|
|||||||
<!-- Hero -->
|
<!-- Hero -->
|
||||||
<div class="hero">
|
<div class="hero">
|
||||||
<h1><?php bloginfo('name'); ?></h1>
|
<h1><?php bloginfo('name'); ?></h1>
|
||||||
<p class="couplet">空笺待写<span>千般意</span>,未寄先存<span>一寸心</span></p>
|
<?php
|
||||||
|
$couplet = esc_html(get_theme_mod('kjweji_hero_couplet', '空笺待写千般意,未寄先存一寸心'));
|
||||||
|
$hl1 = esc_html(get_theme_mod('kjweji_hero_couplet_hl1', '千般意'));
|
||||||
|
$hl2 = esc_html(get_theme_mod('kjweji_hero_couplet_hl2', '一寸心'));
|
||||||
|
$couplet = str_replace($hl1, '<span>' . $hl1 . '</span>', $couplet);
|
||||||
|
$couplet = str_replace($hl2, '<span>' . $hl2 . '</span>', $couplet);
|
||||||
|
?>
|
||||||
|
<p class="couplet"><?php echo $couplet; ?></p>
|
||||||
<p class="intro-text">
|
<p class="intro-text">
|
||||||
这里是自白者的栖息地。<br>
|
<?php echo nl2br(esc_html(get_theme_mod('kjweji_hero_intro', "这里是自白者的栖息地。\n吐槽,落笔,沉思,接住那一缕若有的情绪。\n片语只言,皆是存在。"))); ?>
|
||||||
吐槽,落笔,沉思,接住那一缕若有的情绪。<br>
|
|
||||||
片语只言,皆是存在。
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ $total_pages = ceil($total / $per_page);
|
|||||||
|
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<span class="section-title">📜 笺文</span>
|
<span class="section-title">📜 笺文</span>
|
||||||
<span class="section-filter" style="font-size:13px;color:var(--ink-lighter);">字里行间,尽是岁月</span>
|
<span class="section-filter" style="font-size:13px;color:var(--ink-lighter);"><?php echo esc_html(get_theme_mod('kjweji_articles_subtitle', '字里行间,尽是岁月')); ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($query->have_posts()) : ?>
|
<?php if ($query->have_posts()) : ?>
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ $photo_query = new WP_Query(array(
|
|||||||
|
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<span class="section-title">📷 拾影</span>
|
<span class="section-title">📷 拾影</span>
|
||||||
<span class="section-filter" style="font-size:13px;color:var(--ink-lighter);">在时光里截图</span>
|
<span class="section-filter" style="font-size:13px;color:var(--ink-lighter);"><?php echo esc_html(get_theme_mod('kjweji_photos_subtitle', '在时光里截图')); ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($photo_query->have_posts()) : ?>
|
<?php if ($photo_query->have_posts()) : ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user