Files
hantico/wp-content/themes/hantico/template-parts/specs.php
T

37 lines
1.6 KiB
PHP

<?php
$specs_title = get_field('specs_title', 'option');
$specs_descr = get_field('specs_descr', 'option');
$specs_tabs = get_field('specs_tabs', 'option');
if ($specs_title && $specs_descr && $specs_tabs) :
?>
<section class="specs" id="specs" data-tabs>
<div class="container">
<h2 class="specs-title section-title"><?php echo $specs_title; ?></h2>
<div class="specs-descr section-descr"><?php echo $specs_descr; ?></div>
<div class="specs-body">
<div class="specs-tabs">
<ul class="specs-tabs__list" role="tablist">
<?php $i = 1; foreach ($specs_tabs as $tab) : ?>
<li class="specs-tabs__item<?php echo $i == 1 ? ' is-active' : ''; ?>" role="tab" aria-selected="<?php echo $i == 1 ? 'true' : 'false'; ?>" data-tab="tab-<?php echo $i; ?>"><?php echo $tab['title']; ?></li>
<?php $i++; endforeach; ?>
</ul>
</div>
<div class="specs-panels">
<?php $i = 1; foreach ($specs_tabs as $tab) : ?>
<div class="specs-panel<?php echo $i == 1 ? ' is-active' : ''; ?>" role="tabpanel" data-tab-panel="tab-<?php echo $i; ?>"<?php echo $i != 1 ? ' hidden' : ''; ?>>
<h3 class="specs-panel__title"><?php echo $tab['title']; ?></h3>
<div class="specs-panel__content content"><?php echo $tab['content']; ?></div>
<?php if ($tab['footnotes']) : ?>
<div class="specs-panel__footnotes">
<?php foreach ($tab['footnotes'] as $footnote) : ?>
<p><?php echo $footnote['text']; ?></p>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php $i++; endforeach; ?>
</div>
</div>
</div>
</section>
<?php endif; ?>