导入 AKSRT 主题开发源码
This commit is contained in:
1 parent
9681dd3d48
commit
1268a55dd0
595 files changed
+127705
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Home Module · Button Group
|
||||
*
|
||||
* config: { title?, buttons: [{ label, url, style?, icon? }], align? }
|
||||
*
|
||||
* 按钮组模块,用于 CTA 引导。
|
||||
*/
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$cfg = get_query_var('aksrt_module_config', []);
|
||||
if (!is_array($cfg)) $cfg = [];
|
||||
|
||||
$title = (string) ($cfg['title'] ?? '');
|
||||
$buttons = isset($cfg['buttons']) && is_array($cfg['buttons']) ? $cfg['buttons'] : [];
|
||||
$align = sanitize_key((string) ($cfg['align'] ?? 'center'));
|
||||
|
||||
if (empty($buttons)) return;
|
||||
?>
|
||||
|
||||
<section class="home-module home-module--button-group container" style="text-align:<?php echo esc_attr($align); ?>">
|
||||
<?php if ($title !== '') : ?>
|
||||
<h2 class="home-module__title"><?php echo esc_html($title); ?></h2>
|
||||
<?php endif; ?>
|
||||
<div class="home-module__buttons">
|
||||
<?php foreach ($buttons as $btn) :
|
||||
$label = (string) ($btn['label'] ?? '');
|
||||
$url = (string) ($btn['url'] ?? '#');
|
||||
$style = sanitize_key((string) ($btn['style'] ?? 'primary'));
|
||||
$icon = (string) ($btn['icon'] ?? '');
|
||||
if ($label === '') continue;
|
||||
?>
|
||||
<a href="<?php echo esc_url($url); ?>" class="aksrt-btn aksrt-btn--<?php echo esc_attr($style); ?>">
|
||||
<?php if ($icon !== '') : ?>
|
||||
<i class="<?php echo esc_attr($icon); ?>" aria-hidden="true"></i>
|
||||
<?php endif; ?>
|
||||
<span><?php echo esc_html($label); ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user