导入 AKSRT 主题开发源码
This commit is contained in:
1 parent
9681dd3d48
commit
1268a55dd0
595 files changed
+127705
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Home Module · FAQ
|
||||
*
|
||||
* config: { title?, items: [{ q, a }], columns? }
|
||||
*
|
||||
* FAQ 手风琴模块。
|
||||
*/
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$cfg = get_query_var('aksrt_module_config', []);
|
||||
if (!is_array($cfg)) $cfg = [];
|
||||
|
||||
$title = (string) ($cfg['title'] ?? '');
|
||||
$items = isset($cfg['items']) && is_array($cfg['items']) ? $cfg['items'] : [];
|
||||
$columns = max(1, min(3, (int) ($cfg['columns'] ?? 1)));
|
||||
|
||||
if (empty($items)) return;
|
||||
?>
|
||||
|
||||
<section class="home-module home-module--faq container">
|
||||
<?php if ($title !== '') : ?>
|
||||
<header class="home-module__header">
|
||||
<h2 class="home-module__title"><?php echo esc_html($title); ?></h2>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
<div class="home-module__faq-grid" style="column-count:<?php echo esc_attr((string) $columns); ?>">
|
||||
<?php foreach ($items as $i => $item) :
|
||||
$q = (string) ($item['q'] ?? '');
|
||||
$a = (string) ($item['a'] ?? '');
|
||||
if ($q === '') continue;
|
||||
?>
|
||||
<details class="aksrt-faq-item">
|
||||
<summary class="aksrt-faq-item__question"><?php echo esc_html($q); ?></summary>
|
||||
<div class="aksrt-faq-item__answer"><?php echo wp_kses_post($a); ?></div>
|
||||
</details>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user