导入 AKSRT 主题开发源码
This commit is contained in:
1 parent
9681dd3d48
commit
1268a55dd0
595 files changed
+127705
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Home Module · Text Title
|
||||
*
|
||||
* config: { title, subtitle?, align?, tag? }
|
||||
*
|
||||
* 纯文本标题模块,用于页面分隔和标题引导。
|
||||
*/
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$cfg = get_query_var('aksrt_module_config', []);
|
||||
if (!is_array($cfg)) $cfg = [];
|
||||
|
||||
$title = (string) ($cfg['title'] ?? '');
|
||||
$subtitle = (string) ($cfg['subtitle'] ?? '');
|
||||
$align = sanitize_key((string) ($cfg['align'] ?? 'left'));
|
||||
$tag = sanitize_key((string) ($cfg['tag'] ?? 'h2'));
|
||||
|
||||
if ($title === '' && $subtitle === '') return;
|
||||
|
||||
$valid_tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
||||
if (!in_array($tag, $valid_tags, true)) $tag = 'h2';
|
||||
?>
|
||||
|
||||
<section class="home-module home-module--text-title container" style="text-align:<?php echo esc_attr($align); ?>">
|
||||
<?php if ($title !== '') : ?>
|
||||
<<?php echo esc_attr($tag); ?> class="home-module__title"><?php echo esc_html($title); ?></<?php echo esc_attr($tag); ?>>
|
||||
<?php endif; ?>
|
||||
<?php if ($subtitle !== '') : ?>
|
||||
<p class="home-module__subtitle"><?php echo esc_html($subtitle); ?></p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
Reference in new issue
Block a user