Initial plugin commit

This commit is contained in:
2026-04-12 22:50:16 +02:00
commit d36023a4a3
6 changed files with 491 additions and 0 deletions

22
assets/admin.css Executable file
View File

@@ -0,0 +1,22 @@
.post-type-kgv_faq #post-body-content .editor-post-title,
.post-type-kgv_faq #titlediv #title {
font-weight: 600;
}
.post-type-kgv_faq .misc-pub-section.misc-pub-post-status,
.post-type-kgv_faq .misc-pub-section.curtime {
display: block;
}
.post-type-kgv_faq .column-kgv_faq_order {
width: 90px;
}
.post-type-kgv_faq .column-kgv_faq_answer {
width: 35%;
}
.taxonomy-kgv_faq_cat .wrap h1,
.post-type-kgv_faq .wrap h1 {
margin-bottom: 12px;
}

91
assets/front.css Executable file
View File

@@ -0,0 +1,91 @@
.kgv-faq-wrapper {
margin: 30px 0;
}
.kgv-faq-filter {
margin-bottom: 20px;
}
.kgv-faq-filter select,
.kgv-faq-search {
min-width: 240px;
max-width: 100%;
padding: 10px 12px;
border: 1px solid #d0d7de;
border-radius: 8px;
background: #fff;
}
.kgv-faq-search-wrap {
margin-bottom: 20px;
}
.kgv-faq-list {
display: grid;
gap: 14px;
}
.kgv-faq-item {
border: 1px solid #e5e7eb;
border-radius: 12px;
background: #fff;
overflow: hidden;
}
.kgv-faq-question {
margin: 0;
}
.kgv-faq-toggle {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 16px 18px;
background: #fff;
border: 0;
cursor: pointer;
text-align: left;
font-size: 18px;
font-weight: 600;
color: #111827;
}
.kgv-faq-toggle:hover,
.kgv-faq-toggle:focus {
background: #f9fafb;
outline: none;
}
.kgv-faq-icon {
flex: 0 0 auto;
font-size: 22px;
line-height: 1;
color: #6b7280;
}
.kgv-faq-toggle.is-open .kgv-faq-icon {
transform: rotate(45deg);
}
.kgv-faq-answer {
border-top: 1px solid #eef2f7;
}
.kgv-faq-answer__inner {
padding: 16px 18px 18px;
color: #374151;
}
.kgv-faq-answer__inner > *:first-child {
margin-top: 0;
}
.kgv-faq-answer__inner > *:last-child {
margin-bottom: 0;
}
.kgv-faq-item.is-hidden {
display: none;
}

44
assets/front.js Executable file
View File

@@ -0,0 +1,44 @@
document.addEventListener('click', function (event) {
const button = event.target.closest('[data-kgv-faq-toggle]');
if (!button) {
return;
}
const panelId = button.getAttribute('aria-controls');
const panel = document.getElementById(panelId);
if (!panel) {
return;
}
const isOpen = button.getAttribute('aria-expanded') === 'true';
button.setAttribute('aria-expanded', isOpen ? 'false' : 'true');
button.classList.toggle('is-open', !isOpen);
panel.classList.toggle('is-open', !isOpen);
if (isOpen) {
panel.setAttribute('hidden', '');
} else {
panel.removeAttribute('hidden');
}
});
document.addEventListener('input', function (event) {
const input = event.target.closest('[data-kgv-faq-search]');
if (!input) {
return;
}
const wrapper = input.closest('[data-kgv-faq]');
if (!wrapper) {
return;
}
const value = input.value.trim().toLowerCase();
const items = wrapper.querySelectorAll('[data-kgv-faq-item]');
items.forEach(function (item) {
const text = item.textContent.toLowerCase();
item.classList.toggle('is-hidden', value && !text.includes(value));
});
});