
Főoldal - Határhúzás
Határhúzás
<?php
/**
* Kategória GYIK szekció
* Használat: szolgáltatás kategória archív oldal aljára
* Adatforrás: rwmb_meta 'kat_gyik' term meta (MB Term Meta)
*/
$term_id = get_queried_object_id();
$gyik = rwmb_meta('kat_gyik', ['object_type' => 'term'], $term_id);
if (empty($gyik)) return;
?>
<style>
.faq-section {
padding: 80px 20px;
background-color: #ffffff;
font-family: 'DM Sans', sans-serif;
}
.faq-container {
max-width: 800px;
margin: 0 auto;
}
.faq-title {
font-family: 'Playfair Display', serif;
font-size: 36px;
text-align: center;
color: #333;
margin-bottom: 40px;
position: relative;
}
.faq-title::after {
content: '';
display: block;
width: 50px;
height: 2px;
background-color: #D5A65C;
margin: 15px auto 0;
}
.faq-list {
display: flex;
flex-direction: column;
gap: 15px;
}
.faq-item {
background-color: #F9F7F4;
border-radius: 12px;
overflow: hidden;
transition: all 0.3s ease;
}
.faq-question {
width: 100%;
padding: 22px 30px;
background: none;
border: none;
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
text-align: left;
font-family: 'DM Sans', sans-serif;
font-size: 16px;
font-weight: 500;
color: #333;
}
.faq-question i {
font-size: 14px;
color: #666;
transition: transform 0.3s ease;
}
.faq-item.active {
box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.faq-item.active i {
transform: rotate(180deg);
}
.faq-answer {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out, padding 0.3s ease;
padding: 0 30px;
}
.faq-item.active .faq-answer {
max-height: 200px;
padding-bottom: 25px;
}
.faq-answer p {
margin: 0;
font-size: 15px;
line-height: 1.6;
color: #666;
}
</style>
<section class="faq-section">
<div class="faq-container">
<h2 class="faq-title">Gyakori kérdések</h2>
<div class="faq-list">
<?php foreach ($gyik as $elem) : ?>
<div class="faq-item">
<button class="faq-question">
<span><?php echo esc_html($elem['kerdes']); ?></span>
<i class="fa-solid fa-chevron-down"></i>
</button>
<div class="faq-answer">
<?php echo wp_kses_post($elem['valasz']); ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<script>
document.querySelectorAll('.faq-question').forEach(function(btn) {
btn.addEventListener('click', function() {
var item = this.closest('.faq-item');
var isActive = item.classList.contains('active');
// Többi bezárása
document.querySelectorAll('.faq-item.active').forEach(function(el) {
el.classList.remove('active');
});
// Ha nem volt nyitva, nyissuk ki
if (!isActive) {
item.classList.add('active');
}
});
});
</script>