=== HND FAQ – Frequently Asked Questions ===
Contributors: hundikuu, hndagentuur
Tags: faq, accordion, schema, questions, gutenberg
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 2.0.2
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

FAQ accordion with Schema.org markup, Gutenberg block, Elementor widget, Table of Contents, live search, drag & drop reorder, and more.

== Description ==

A complete FAQ plugin for WordPress. Display your frequently asked questions as an accessible accordion with automatic Schema.org FAQPage JSON-LD markup for rich results in search engines.

**Features:**

* Unlimited FAQ items and categories
* Accessible accordion — keyboard navigation, ARIA attributes
* Schema.org FAQPage JSON-LD — automatic rich result markup
* Gutenberg block with sidebar controls
* Elementor widget
* Shortcode `[hnd_faq]` with all options
* Table of Contents — inline above the accordion or sticky sidebar
* Drag &amp; drop question reorder in admin
* Per-question colour overrides
* "Was this helpful?" thumbs up/down voting
* Open-count analytics (per-question view tracking)
* Category ordering by custom number
* Print CSS and RTL support
* WPML and Polylang compatible
* Import / Export via CSV

**Pro version available**

[HND FAQ Pro](https://hundikuu.com/plugin/hnd-faq-pro) adds:

* Live search across all questions and answers
* Suggest a question — front-end submission form
* Card / Grid layout (questions and answers visible simultaneously)
* WooCommerce product tab integration
* Table of Contents customisation — scrollspy, colours, numbered list
* Custom CSS editor
* Conditional display by role, page, or post type
* Advanced analytics dashboard widget
* Priority email support

**Shortcode examples:**

`[hnd_faq]`
`[hnd_faq category="general"]`
`[hnd_faq category="general,technical" orderby="title" order="ASC"]`
`[hnd_faq show_titles="false" limit="5"]`

**Shortcode attributes:**

* `category` — category slug(s), comma-separated (default: all)
* `orderby` — `menu_order` | `title` | `date` (default: `menu_order`)
* `order` — `ASC` | `DESC` (default: `ASC`)
* `limit` — number of items, `-1` for all (default: `-1`)
* `show_titles` — show category headings: `true` | `false` (default: `true`)
* `toc` — table of contents position: `none` | `above` | `sidebar` (default: global setting)
* `class` — extra CSS class on the wrapper

**Customisation:**

The plugin uses CSS custom properties that can be overridden in your theme:

`--hnd-faq-accent`, `--hnd-faq-accent-bg`, `--hnd-faq-head-bg`, `--hnd-faq-border-color`, `--hnd-faq-border-radius`, and more. All visual settings are also available from **FAQ → Settings** with a live preview.

== Installation ==

1. Upload the `hnd-faq` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **FAQ → Add New Question** to create your first question.
4. Assign questions to categories under **FAQ → Categories**.
5. Add the `[hnd_faq]` shortcode to any page, or insert the **FAQ Accordion** block in the block editor or Elementor editor.

== Frequently Asked Questions ==

= How do I display FAQ questions on a page? =

Use the shortcode `[hnd_faq]` or insert the **FAQ Accordion** Gutenberg block. An Elementor widget is also available.

= Can I show only certain categories? =

Yes — use the `category` shortcode attribute with a category slug: `[hnd_faq category="general"]`. Multiple slugs are comma-separated.

= Does it output Schema.org markup? =

Yes. FAQPage JSON-LD is automatically added to every page where the accordion is rendered. This enables rich results (accordion snippets) in Google Search.

= Is the accordion accessible? =

Yes — the accordion uses proper ARIA attributes (`aria-expanded`, `aria-controls`, `hidden`) and is fully keyboard-navigable.

= How do I change the colours? =

Go to **FAQ → Settings → Colors**. A live preview updates as you make changes. You can also override the CSS custom properties directly in your theme.

= Does it work with WPML or Polylang? =

Yes. The plugin registers the FAQ post type and taxonomy with both WPML (via `wpml-config.xml`) and Polylang (via filters), so all questions and categories are translatable.

= Can I import questions from a CSV file? =

Yes. Go to **FAQ → Import / Export** to download a sample CSV, fill it in, and upload it. Existing questions can be skipped or updated on import.

== Screenshots ==

1. FAQ accordion on the front end
2. Gutenberg block with sidebar settings
3. Settings page with live preview
4. Admin question list with drag & drop reorder

== Changelog ==

= 2.0.2 =
* Fix: main plugin file renamed from index.php to hnd-faq.php (WP.org directory requirement)
* Fix: all inline <script> and <style> output converted to wp_add_inline_script / wp_add_inline_style
* Fix: JSON-LD schema output now uses JSON_HEX_TAG to prevent script-breaking characters
* Fix: sortable AJAX handler now casts array position keys to int before DB write
* Fix: TOC before-list filter output wrapped in wp_kses_post()
* Fix: removed load_plugin_textdomain() — WordPress 4.6+ auto-loads translations
* Fix: added hndagentuur to Contributors
* Checked compatibility with Wordpress 7.0
* PHPCS + WPCS checks 


= 2.0.1 =
* Security: replaced all `wp_redirect()` with `wp_safe_redirect()`
* Security: added nonce verification to category order form
* Security: proper `wp_unslash()` before sanitization throughout
* Code: replaced deprecated `get_page_by_title()` with `get_posts()`
* Code: `date()` replaced with `gmdate()` for timezone safety
* Plugin slug renamed from `hnd-faq-plugin` to `hnd-faq` (WP.org requirement)
* Tested up to WordPress 6.9

= 2.0.0 =
* Rewritten with modular file structure (`includes/`, `block/`)
* New: Gutenberg server-side rendered block
* New: Elementor widget
* New: Table of Contents — inline and sticky sidebar
* New: Drag & drop question reorder
* New: Per-question colour overrides
* New: "Was this helpful?" voting widget
* New: Open-count analytics
* New: Import / Export via CSV
* New: Admin settings page with live preview (FAQ → Settings)
* New: CSS custom properties — colours and spacing from settings
* New: Expand all / Collapse all button
* New: Anchor copy button per question
* New: Category ordering by custom number
* New: Print CSS and RTL support
* New: WPML support (`wpml-config.xml` + filters)
* New: Polylang support (filters)
* Accessible accordion — keyboard navigation, ARIA, `hidden` attribute
* Three toggle icon styles: +/−, chevron, arrow
* Post type slug changed from `edi-faq` to `hnd-faq-question`
* Taxonomy slug changed from `faq-cat` to `hnd-faq-cat`



== Upgrade Notice ==

= 2.0.0 =
The post type slug has changed. If you are upgrading from 1.0.x, please flush rewrite rules by visiting **Settings → Permalinks** after updating.
