=== Codedication Schema Blocks ===
Contributors: codedication, pauloc
Donate link: https://codedication.com
Tags: structured data, faq schema, review schema, json-ld, star rating
Requires at least: 6.5
Tested up to: 6.9
Stable tag: 1.0.1
Requires PHP: 8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

FAQ schema and Review schema blocks. Generate JSON-LD structured data, enable star ratings, and boost your rich snippets in Google Search.

== Description ==

= FAQ Schema & Review Schema Blocks =

Schema Blocks adds **FAQ schema** and **Review schema** directly to the WordPress block editor — no shortcodes, no custom fields, no coding required. Each block automatically generates valid **JSON-LD structured data** that Google can read to display **rich results** in search: FAQ dropdowns, star ratings, and review snippets.

Built for Gutenberg. Works with Yoast SEO, Rank Math, and AIOSEO.

= Why Schema Markup Matters =

Schema markup helps search engines understand your content better, resulting in:

* **Google Rich Results** — FAQ dropdowns and star ratings displayed directly in search results
* **Better CTR** — More clicks from visually enhanced search listings
* **Voice Search** — Structured Q&A content ready for voice assistants
* **Knowledge Graph** — Potential for featured snippets and entity recognition

= Features =

**FAQ Block** — [Google FAQ Rich Result](https://developers.google.com/search/docs/appearance/structured-data/faqpage)

* Displays as expandable Q&A dropdowns directly in Google Search results
* Accordion-style interface in the block editor with full styling control
* Option to close others when one opens
* Proper FAQPage / Question / Answer schema.org markup

**Review Block** — [Google Review Snippet](https://developers.google.com/search/docs/appearance/structured-data/review-snippet)

* Displays star ratings (1–5) in Google Search results for Products, Books, Local Businesses, and more
* Multiple item types: Product, LocalBusiness, Movie, Book, Restaurant, Thing
* Author and publisher information, publication date, review body
* Positive/negative notes and rating explanation

**Settings Page** — Site-wide structured data from a single dashboard

* **Site Identity** — Organization or Person schema with name, logo, description, contact, social profiles, and founding year
* **WebSite schema** — Site name, URL, and SearchAction for Google sitelinks search box
* **Breadcrumbs** — BreadcrumbList schema with separator and home label configuration
* **Block management** — Enable or disable individual schema blocks
* **JSON-LD preview** — Live preview of your site-wide schema output with one-click copy and "Test in Google Rich Results" button
* **Completeness indicator** — Visual progress ring showing how much of your identity schema is filled in

**Built for SEO workflows**
* Automatic JSON-LD output in the page head — single `@graph` array for multiple schemas
* Compatible with Google Rich Results Test and Schema.org Validator
* Works directly in the Gutenberg block editor

= Compatible with Popular SEO Plugins =

Schema Blocks works **alongside** your existing SEO plugin — it does not replace it:

* **Yoast SEO** — Yoast handles meta tags and site-wide schema; Schema Blocks handles content-level schema
* **Rank Math** — Disable duplicate schema types in Rank Math settings if needed
* **AIOSEO** — Fully compatible; disable conflicting schema modules in AIOSEO
* **The SEO Framework** — Compatible out of the box

If you already have a plugin generating FAQ or Review schema for entire pages, we recommend disabling that specific schema type to avoid duplication.

= How It Works =

1. Add a Schema Block (FAQ or Review) to any post or page in the block editor
2. Fill in your content — questions and answers, ratings, review details
3. The plugin outputs valid JSON-LD structured data in the page `<head>`
4. Google reads the schema markup and may display rich results: FAQ dropdowns, star ratings, review snippets

= Validation =

All schema output follows Google's structured data guidelines. Test your pages with:
* [Google Rich Results Test](https://search.google.com/test/rich-results)
* [Schema.org Validator](https://validator.schema.org/)

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/cddc-schema-blocks/`
2. Activate the plugin through the 'Plugins' screen in WordPress
3. Go to Settings → Schema Blocks to configure options
4. Add Schema blocks in the editor under "Schema Blocks" category

== Frequently Asked Questions ==

= Will this guarantee rich snippets in Google? =

No. Google decides whether to show rich snippets based on many factors. Proper schema markup improves your chances but doesn't guarantee display.

= Does this conflict with Yoast SEO or Rank Math? =

Schema Blocks focuses on content-level schema (FAQ, Review) which complements site-wide schema from SEO plugins. We recommend disabling duplicate schema types if your SEO plugin also provides them. See the "Compatible with Popular SEO Plugins" section above for plugin-specific guidance.

= Does it work with Full Site Editing (FSE) themes? =

Yes. Schema Blocks uses the standard Gutenberg block API and works with any block theme, including FSE themes like Twenty Twenty-Four, Kadence Blocks, or GeneratePress.

= Do I need technical knowledge? =

No! Just add blocks and fill in the fields. The plugin handles all the technical JSON-LD markup automatically.

= Is the schema valid? =

Yes. All output follows Schema.org specifications and Google's structured data guidelines.

= What about performance? =

Schema is output as a single JSON-LD script in the page head. It's lightweight and doesn't affect page load time or Core Web Vitals.

= Can I use this with WooCommerce? =

Yes. You can add Review schema to any post type, including WooCommerce product pages.

= Does it add Organization or Person schema? =

Yes. The Settings page includes a Site Identity section where you configure Organization or Person schema with name, logo, description, email, phone, address, social profiles, and founding year. A completeness indicator shows your progress.

= How many FAQ items can I add? =

There is no limit. Add as many Question/Answer pairs as you need. All items are included in the FAQPage JSON-LD output.

== Screenshots ==
1. FAQ Block styling — Color, Typography and Dimensions controls in the Inspector sidebar
2. FAQ Block with a custom theme — fully stylable to match your brand
3. FAQ Block frontend output — clean accordion rendered on the published page
4. Review Block in the editor — star rating, item type selector and review body with 4.5/5 rating
5. Review Block author & publisher — date, Author (Person) and Publisher (Organization) fields for valid Review schema
6. Review Block frontend output — headline, rating, review body and positive/negative notes
7. Settings page — Site Identity (Organization/Person), JSON-LD preview, completeness indicator and "Test in Google Rich Results" shortcut

== Changelog ==

= 1.0.1 =
* Fix (WordPress.org review): conflict admin notice no longer emits an inline `<script>` tag — the dismiss handler is now an enqueued asset (`assets/admin/conflict-notice.js`) wired via `data-*` attributes on the notice container. The notice is also gated to the plugin Settings page and `plugins.php` only.
* Fix (WordPress.org review): FAQ block render callback no longer echoes a `WP_HTML_Tag_Processor`-mutated HTML string. The wrapper `<div>` is composed from escape-aware core APIs, and per-`<details>` Interactivity API directives are now injected via a `render_block` filter scoped to FAQ-ancestor renders. Foreign `data-wp-*` directives on nested blocks are preserved.
* Fix: Settings page rendered empty when the centralized Codedication admin was active. The plugin now registers a "Settings" tab inside the centralized renderer and the React app hydrates from saved option values.
* Fix: `useSlotFills` crash on older `@wordpress/components`; the Advanced tab now derives its visibility from the internal fill bridge.
* Improvement: Completeness score redistributed to weigh Site Identity (75), Website (20) and Breadcrumbs (5) — previously only Site Identity counted, so the page could reach 100% while Website and Breadcrumbs were empty.
* New filter: `cddc_schema_blocks_is_settings_screen` lets integrations declare authoritatively when the React Settings app should be enqueued.
* Cleanup: removed dead code paths in `Admin_Integration`, dead `utils/completeness-score.ts` / `utils/json-ld-preview.ts` modules, the unused `HelpTip` component family and the divergent PHP `Site_Schema::get_completeness_score()` (the React UI is now the single source of truth for completeness).
* Fix: schema-conflict admin notice now links to the real settings screen (`Admin_Integration::get_settings_url()`) instead of guessing from `class_exists()`, so the link is correct in the fallback path where the shared admin package exists but its renderer is not yet available.

= 1.0.0 =
* Initial release
* FAQ Block with FAQPage schema
* FAQ Item child block
* Review Block with Review schema
* Support for 6 item types
* Settings page for block management
* Interactivity API for accordion

== Upgrade Notice ==

= 1.0.1 =
Fixes the Settings page appearing empty under the centralized admin. Saved values now hydrate correctly. Recommended upgrade.

= 1.0.0 =
First release — FAQ Block with FAQPage schema and Review Block with star ratings and JSON-LD output.
