Change accordion logic
This commit is contained in:
@@ -49,8 +49,8 @@
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<div class="c-tabs--content">
|
||||
<?php foreach ($box2['tabs'] as $i => $tab) : ?>
|
||||
<div tab_id="<?= $i + 1; ?>" class="c-tab--item" <?= $i === 0 ? 'style="display: block;"' : ''; ?>>
|
||||
<?php foreach ($box2['tabs'] as $tab_id => $tab) : ?>
|
||||
<div tab_id="<?= $tab_id + 1; ?>" class="c-tab--item" <?= $i === 0 ? 'style="display: block;"' : ''; ?>>
|
||||
<div class="t-row t-row-1">
|
||||
<div class="t-col t-col-1">
|
||||
<div class="t-head">
|
||||
@@ -61,36 +61,59 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="t-row t-row-2">
|
||||
<div class="t-row t-row-2 c-acc-group">
|
||||
<div class="t-col t-col-1">
|
||||
<ol class="c-acc">
|
||||
<?php foreach ($tab['accordion'] as $i => $item) : ?>
|
||||
<li class="c-acc--item">
|
||||
<ol class="c-acc-advanced" acc_parent_id="<?= $tab_id + 1; ?>">
|
||||
<?php foreach ($tab['accordion'] as $parent_item_id => $item) : ?>
|
||||
<li class="c-acc--item" acc_parent_item_id="<?= $parent_item_id + 1; ?>">
|
||||
<div class="c-acc--head">
|
||||
<i class="icon"></i>
|
||||
<span><?= esc_html($item['title']); ?></span>
|
||||
</div>
|
||||
<div class="c-acc--body">
|
||||
<div class="c-acc--body-text">
|
||||
<p><?= esc_html($item['text']); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="t-col t-col-2">
|
||||
<div class="tab-description">
|
||||
<div class="tab-description--head">
|
||||
<h3><?= esc_html($tab['card_description_second']['title']); ?></h3>
|
||||
</div>
|
||||
<div class="tab-description--text">
|
||||
<?= $tab['card_description_second']['text']; ?>
|
||||
</div>
|
||||
<a class="btn_2" href="<?php echo esc_url($tab['card_description_second']['btn']['url']); ?>" target="<?php echo esc_attr($tab['card_description_second']['btn']['target'] ?: '_self'); ?>">
|
||||
<?php echo esc_html($tab['card_description_second']['btn']['title']); ?>
|
||||
</a>
|
||||
</div>
|
||||
<ol class="c-acc-advanced" acc_child_id="<?= $tab_id + 1 ; ?>">
|
||||
<?php foreach ($tab['accordion'] as $child_item_id => $item) :
|
||||
$title = $item['accordion_data']['title'] ?? '';
|
||||
$text = $item['accordion_data']['text'] ?? '';
|
||||
$btn = $item['accordion_data']['btn'] ?? [];
|
||||
$btn_url = $btn['url'] ?? '';
|
||||
$btn_title = $btn['title'] ?? '';
|
||||
$btn_target = $btn['target'] ?? '_self';
|
||||
|
||||
// if (empty($title) && empty($text) && empty($btn_url) && empty($btn_title)) {
|
||||
// continue;
|
||||
// }
|
||||
?>
|
||||
<li class="c-acc--item" acc_child_item_id="<?= $child_item_id + 1; ?>">
|
||||
<div class="c-acc--body">
|
||||
<?php if (!empty($title)) : ?>
|
||||
<div class="tab-description--head">
|
||||
<h3><?= esc_html($title); ?></h3>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($text)) : ?>
|
||||
<div class="tab-description--text">
|
||||
<?= wp_kses_post($text); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($btn_url) && !empty($btn_title)) : ?>
|
||||
<a class="btn_2"
|
||||
href="<?= esc_url($btn_url); ?>"
|
||||
target="<?= esc_attr($btn_target); ?>">
|
||||
<?= esc_html($btn_title); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user