=== Tabbed FAQ ===
Contributors: dovidev
Tags: faq, accordion, tabs, schema, json-ld
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight tabbed FAQ accordion with category tabs, FAQPage schema output and a CSV importer. No page builder required.

== Description ==

Tabbed FAQ creates a structured FAQ system using a custom post type and category taxonomy, rendered via a shortcode. It is framework-agnostic (no Elementor or page builder required) and designed for large FAQ sets, SEO safety, and easy customization.

Features include:
* Custom Post Type for FAQs
* Custom taxonomy for FAQ categories
* Horizontal, scrollable category tabs with arrow controls
* Accordion-style questions and answers
* FAQPage JSON-LD schema output
* CSV importer for bulk creation and updates
* Shortcode-based rendering

== Installation ==

1. Upload the plugin ZIP via Plugins → Add New → Upload Plugin
2. Activate the plugin
3. A new “FAQs” menu will appear in the WordPress admin

== Data Structure ==

Custom Post Type:
Post Type: tabbed_faq
Supports: Title, Editor, Menu Order, Revisions

Each FAQ:
* Title = Question
* Content = Answer

Taxonomy:
Taxonomy: tabbed_faq_category
Used to generate the category tabs

== Usage ==

Use the shortcode:

[tabbed_faq]

The shortcode can be placed in:
* Pages
* Posts
* Shortcode blocks
* PHP templates using do_shortcode()

== Shortcode Attributes ==

show_all_tab (default: 1)
Show an “All” tab at the beginning.

all_tab_label (default: All)
Label for the “All” tab.

default_category (default: all)
Category slug to load first.

posts_per_page (default: 300)
Maximum FAQs per category.

orderby (default: menu_order)
Sorting field.

order (default: ASC)
Sort direction.

include_categories (default: empty)
Comma-separated category slugs to include.

exclude_categories (default: empty)
Comma-separated category slugs to exclude.

schema_mode (default: all)
Controls schema output.
Possible values:
* all – include all FAQs on the page (recommended)
* active – include only the default category

Examples:

[tabbed_faq]

[tabbed_faq default_category="vehicle-care"]

[tabbed_faq include_categories="technical,services"]

[tabbed_faq schema_mode="active"]

== FAQ Schema Behavior ==

By default (schema_mode="all"):

* Outputs a single FAQPage JSON-LD block
* Includes all FAQs rendered on the page
* Merges schema from multiple shortcodes into one block

When using schema_mode="active":

* Only FAQs from the default category are included in schema

Schema output:
* Is generated from actual FAQ content
* Is printed once per page in the document head
* Is safe for SEO and Google FAQ guidelines

== CSV Importer ==

Accessible via:
FAQs → Import FAQs

CSV requirements:
* Header row required
* UTF-8 encoded CSV

Supported columns:

category (required)
Category name or slug

question (required)
FAQ question

answer (required)
FAQ answer (HTML allowed)

id (optional)
Existing FAQ post ID to update

slug (optional)
Post slug to match/update

Update modes:
* Prefer ID, then Slug (default)
* Slug only
* Always create new

If no match is found, a new FAQ is created automatically.

== Styling ==

Default styles are located at:
assets/css/tabbed-faq.css

Key CSS selectors:
.tabbed-faq
.tabbed-faq__tabs
.tabbed-faq__tab
.tabbed-faq__accordion
.tabbed-faq__item
.tabbed-faq__toggle
.tabbed-faq__answer

Styles may be overridden in the theme or by dequeuing the stylesheet.

== JavaScript ==

JavaScript file:
assets/js/tabbed-faq.js

Handles:
* Tab switching
* Horizontal tab scrolling
* Accordion open/close behavior
* ARIA attribute updates

No external dependencies.

== Accessibility ==

* Tabs use proper tablist and tab roles
* Accordion buttons use aria-expanded and aria-controls
* Only one accordion item is open per category at a time

== Performance ==

* Uses get_posts() for data retrieval
* No AJAX requests
* Schema generated once per page
* Suitable for large FAQ sets

== Uninstall ==

Deactivating the plugin:
* Removes frontend output
* Does not delete FAQ posts or categories

Manual cleanup requires deleting tabbed_faq posts and taxonomy terms.

== Screenshots ==

1. The front-end FAQ, with a tab per category and the first answer open.
2. Opening straight to one category with default_category.
3. FAQs are edited as an ordinary post type. The title is the question, the content is the answer.
4. The shortcode reference built into the FAQs menu.
5. The CSV importer, for bringing a whole FAQ set in at once.

== Changelog ==

= 1.0.6 =
* Fixed: the activation routine never ran, so rewrite rules were not flushed on activation.
* Hardened the FAQPage JSON-LD output against answer content containing HTML.

= 1.0.5 =
* Renamed to Tabbed FAQ for the WordPress.org directory.

= 1.0.4 =
* Security: FAQ answers are passed through wp_kses_post() on output; uploaded CSV path is validated with is_uploaded_file().
* Code: replaced short echo tags; added plugin header requirements.
* Prepared for WordPress.org (Plugin Check clean).

= 1.0.3 =
* Cleaned up ready to go

= 1.0.2 =
* Added Column, Bulk and Quick editing for Tabbed FAQ Categories
* Changed category to hierarchical like post categories
* Made import an AJAX process

= 1.0.1 =
Added Plugin Update Checker

= 1.0.0 =
Initial release.
Tabbed FAQ CPT, taxonomy, shortcode rendering, schema output, and CSV importer.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
