=== WPFAQBlock – FAQ & Accordion Plugin For Gutenberg ===
Contributors: creativewerkdesigns
Tags: faq, faq schema, accordion, faq block, shortcode
Requires at least: 6.1
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

FAQ builder and accordion plugin with FAQ Schema, Gutenberg block, shortcode, AI FAQ generation, category filters, import/export, and custom icons.

== Description ==

WPFAQBlock is a WordPress FAQ builder and accordion plugin for creating, managing, and displaying professional FAQ sections across your website.

Use WPFAQBlock to build support FAQs, product FAQs, service FAQs, help center questions, documentation FAQs, and clear question-and-answer content for posts, pages, widgets, and custom post types. The plugin includes a visual FAQ builder, Gutenberg block support, shortcode output, FAQ category filtering, optional FAQPage JSON-LD schema, custom accordion icons, import/export tools, and AI-assisted FAQ generation with OpenAI or Google Gemini.

Frontend FAQ content is rendered as HTML, and optional FAQPage JSON-LD structured data can be enabled for eligible FAQ pages. This helps search engines understand your FAQ content without forcing schema output on every site.

WPFAQBlock is designed for site owners, agencies, ecommerce stores, service businesses, content teams, and developers who need a flexible FAQ plugin that stays lightweight, accessible, and easy to manage.

= Key Features =

* **Visual FAQ Builder** - Create, edit, organize, and manage FAQs from a clean admin interface.
* **Accordion FAQ Layout** - Display FAQs in a user-friendly collapsible accordion format.
* **Gutenberg FAQ Block** - Add FAQ sections directly from the WordPress block editor.
* **FAQ Shortcode** - Display FAQs anywhere with the `[wpfaqblock]` shortcode.
* **Per-Instance FAQ Selection** - Choose all FAQs, selected FAQs, or FAQs from selected categories for each display.
* **FAQ Categories** - Group FAQs by category and show only the content needed on each page.
* **Optional FAQ Schema** - Enable FAQPage JSON-LD structured data only when you want schema output.
* **Displayed-Only Schema Output** - Schema is generated only from FAQs actually rendered on the current page.
* **Custom Accordion Icons** - Upload separate open and closed accordion icons from the WordPress Media Library.
* **Open First Accordion Option** - Choose whether the first FAQ item should be open by default.
* **Import and Export FAQs** - Export all FAQs, selected FAQs, single categories, or multiple categories as JSON.
* **AI FAQ Generation** - Generate FAQ suggestions from builder prompts or editor content using OpenAI or Gemini.
* **Editor Content FAQ Generator** - Generate FAQs while editing a post, page, product, or supported custom post type.
* **Custom Post Type Storage** - FAQs are stored as WordPress content for easier management, backups, and migration.

= Common Use Cases =

* Product FAQ sections for WooCommerce or ecommerce pages.
* Service FAQs for local business, agency, and landing pages.
* Help center or support FAQ content.
* Documentation pages with categorized questions and answers.
* FAQ schema structured data for eligible FAQ content.
* Reusable FAQ blocks across posts, pages, widgets, and templates.
* AI-assisted FAQ creation from existing page or post content.

== Shortcode Usage ==

Display all published FAQs:

`[wpfaqblock]`

Display FAQs from one category:

`[wpfaqblock category="returns"]`

Limit the number of FAQs:

`[wpfaqblock category="returns" limit="5"]`

Hide the category title:

`[wpfaqblock category="returns" category_title="0"]`

Change FAQ order:

`[wpfaqblock category="general" order="DESC"]`

Open the first accordion item by default:

`[wpfaqblock category="general" open_first="1"]`

Display specific FAQs only:

`[wpfaqblock ids="12,34,56"]`

Use custom accordion icons:

`[wpfaqblock ids="12,34" closed_icon="https://example.com/closed.png" open_icon="https://example.com/open.png"]`

= Shortcode Attributes =

* `category` - Filter FAQs by `faq_group` term slug. Leave empty to show all FAQs.
* `ids` - Comma-separated FAQ post IDs for showing specific FAQs only.
* `limit` - Maximum number of FAQs to display. Use `-1` to show all matching FAQs.
* `order` - Sort order. Accepts `ASC` or `DESC`.
* `category_title` - Set to `0` to hide the category heading above grouped FAQ output.
* `open_first` - Set to `1` to open the first accordion item by default.
* `closed_icon` - Image URL for the closed accordion state.
* `open_icon` - Image URL for the open accordion state.

== Installation ==

1. Upload the `wpfaqblock` folder to `/wp-content/plugins/`.
2. Activate the plugin from **Plugins > Installed Plugins** in WordPress.
3. Go to **WPFAQBlock > Dashboard** to create and organize FAQs.
4. Add FAQs to your site with the Gutenberg block or the `[wpfaqblock]` shortcode.
5. Optional: Go to **WPFAQBlock > Settings** to configure FAQ Schema, API keys, and display preferences.

== Frequently Asked Questions ==

= How do I display FAQs on a page? =
Use the WPFAQBlock Gutenberg block or add the `[wpfaqblock]` shortcode to any post, page, widget area, or supported template area.

= Can I choose exactly which FAQs appear on a page? =
Yes. Each FAQ display can show all FAQs, selected FAQs, or FAQs from selected categories. This lets you reuse one FAQ library across many pages while showing only the most relevant questions.

= Can I show FAQs from multiple categories? =
Yes. The plugin supports category-based FAQ selection, including multiple category selection in supported display and export workflows.

= Can I hide the FAQ category title? =
Yes. Use the category title setting in the block or builder controls, or set `category_title="0"` in the shortcode.

= Can I open the first accordion item by default? =
Yes. Enable the open-first option in the display settings or use `open_first="1"` in the shortcode.

= Can I upload custom accordion icons? =
Yes. WPFAQBlock lets you choose custom images for the open and closed accordion states using the WordPress Media Library. If no custom icons are selected, the plugin uses the default icons.

= Does WPFAQBlock output FAQ Schema? =
FAQ Schema is disabled by default. You can enable it from **WPFAQBlock > Settings**. When enabled, WPFAQBlock outputs FAQPage JSON-LD only for FAQs actually displayed on the current page.

= What happens if multiple FAQ sections are on the same page? =
WPFAQBlock collects the rendered FAQs and de-duplicates schema output so repeated FAQs are not unnecessarily duplicated in the JSON-LD.

= Can I import or export FAQs? =
Yes. You can export all FAQs, selected FAQs, FAQs from one category, or FAQs from multiple categories. Imported FAQs can preserve their categories or be assigned to a selected category.

= How does the AI FAQ Generator work? =
WPFAQBlock can generate FAQ suggestions with OpenAI or Google Gemini. You can generate FAQs from a prompt in the FAQ Builder or from the current editor content while editing a post, page, product, or supported custom post type.

= Does AI generation require an API key? =
Yes. Add an OpenAI API key or Google Gemini API key in **WPFAQBlock > Settings**. If both keys are available, the plugin can fall back to the other provider when one provider is temporarily unavailable.

= Does this plugin require jQuery? =
No. WPFAQBlock uses vanilla JavaScript for frontend accordion behavior and admin interactions.

= Where are FAQs stored? =
FAQs are stored as a WordPress Custom Post Type (`wpfaqblock`) and organized with the `faq_group` taxonomy. This keeps FAQ content compatible with normal WordPress backups, exports, and migrations.

== Screenshots ==

1. FAQ Builder with categorized FAQs, inline editing, status controls, and drag-and-drop ordering.
2. FAQ display settings for selecting all FAQs, specific FAQs, or FAQ categories.
3. Design controls for accordion behavior, custom icons, category title display, and shortcode generation.
4. Frontend FAQ accordion output with accessible expand and collapse behavior.
5. FAQ Schema and API key settings.
6. AI FAQ Generator for creating FAQ suggestions from prompts or editor content.
7. Import and export tools for all FAQs, selected FAQs, and category-based FAQ exports.

== Changelog ==

= 2.0.0 =
* Thursday, 11 June 2026
* Added visual FAQ Builder with inline editing.
* Added drag-and-drop reordering for FAQs and groups.
* Added AI FAQ Generator with OpenAI and Google Gemini support.
* Added `[wpfaqblock]` shortcode with category, limit, order, selected FAQ, category title, icon, and accordion attributes.
* Added Gutenberg block support for FAQ display controls.
* Added per-instance FAQ selection for all FAQs, selected FAQs, and category-based FAQ output.
* Added dynamic shortcode generation so copied shortcodes reflect current selection and design settings.
* Added custom accordion open and closed icon image controls with WordPress Media Library support.
* Added optional FAQPage JSON-LD schema output, disabled by default.
* Added schema output based only on FAQs rendered on the current page.
* Added de-duplication for FAQ schema output when multiple FAQ instances appear on one page.
* Added setting to control whether the first accordion item opens by default.
* Added FAQ import/export tools with export all, selected FAQ export, single-category export, multiple-category export, and import target category options.
* Added editor-only AI FAQ generation for posts, pages, products, and supported custom post types.
* Added Gemini and OpenAI fallback handling when both API keys are available.
* Improved admin UI by removing unused Professional and Pro License sections for now.

= 1.2.1 =
* Saturday, 30 May 2026
* Tested with WordPress 7.0.

= 1.2.0 =
* Tuesday, 24 March 2026
* Changed: Refined allowed HTML tags to improve content formatting while maintaining security.
* Changed: Improved template file naming structure to ensure consistency and better future compatibility.

= 1.1.1 =
* Monday, 9 February 2026
* Changed: Optimized code for better performance.

= 1.0.1 =
* Thursday, 23 March 2023
* Added: Ability to create unlimited custom templates.

= 1.0.0 =
* Thursday, 9 March 2023
* Added: Initial release of the plugin.
