导入 AKSRT 主题开发源码
This commit is contained in:
1 parent
9681dd3d48
commit
1268a55dd0
595 files changed
+127705
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Home Module · Data Grid
|
||||
*
|
||||
* config: { title?, items: [{ value, label, icon? }], columns? }
|
||||
*
|
||||
* 数据展示网格,用于统计数据、里程碑等。
|
||||
*/
|
||||
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(2, min(6, (int) ($cfg['columns'] ?? 4)));
|
||||
|
||||
if (empty($items)) return;
|
||||
?>
|
||||
|
||||
<section class="home-module home-module--data-grid 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__data-grid" style="grid-template-columns:repeat(<?php echo esc_attr((string) $columns); ?>, 1fr)">
|
||||
<?php foreach ($items as $item) :
|
||||
$value = (string) ($item['value'] ?? '');
|
||||
$label = (string) ($item['label'] ?? '');
|
||||
$icon = (string) ($item['icon'] ?? '');
|
||||
if ($value === '' && $label === '') continue;
|
||||
?>
|
||||
<div class="aksrt-data-cell">
|
||||
<?php if ($icon !== '') : ?>
|
||||
<i class="<?php echo esc_attr($icon); ?>" aria-hidden="true"></i>
|
||||
<?php endif; ?>
|
||||
<span class="aksrt-data-cell__value"><?php echo esc_html($value); ?></span>
|
||||
<span class="aksrt-data-cell__label"><?php echo esc_html($label); ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user