
=== AgilePress Schema JSON-LD Block ===

Contributors:      AgilePress
Tags:              schema, json-ld, structured-data, seo
Tested up to:      6.9
Stable tag:        1.0.0
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

A powerful WordPress block for managing Schema.org structured data markup with template support and dynamic placeholder replacement.

== Description ==

AgilePress Schema JSON-LD Block is a sophisticated block for adding Schema.org structured data to your WordPress posts and pages. It provides a clean, user-friendly interface for managing JSON-LD markup without cluttering your content editor.

**Key Features:**

* **Clean Editor Interface**: Displays only a visual placeholder in the editor, keeping your workspace uncluttered
* **Sidebar Editing**: All JSON-LD editing happens in the Block Sidebar via InspectorControls
* **Template Library**: Pre-built templates for common schema types including LocalBusiness, Organization, and FAQ
* **Real-time Validation**: Instant JSON validation feedback as you type
* **Dynamic Placeholders**: Support for WordPress core placeholders and ACF custom fields
* **SEO Optimized**: Outputs clean JSON-LD markup via wp_head for optimal search engine parsing

**Supported Placeholders:**

* `{{title}}` - Post/page title
* `{{excerpt}}` - Post excerpt
* `{{date}}` - Publication date
* `{{url}}` - Current post URL
* `{{featured_image_url}}` - Featured image URL
* `{{acf:field_name}}` - Any ACF field (supports strings and arrays)

**Template Options:**

1. **Blank** - Start from scratch
2. **LocalBusiness** - Perfect for local business listings
3. **Organization** - For company/organization information
4. **FAQ** - Structured FAQ markup

The block uses dynamic rendering to process placeholders on the frontend, ensuring your structured data always reflects current content.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/agilepress-schema-json-ld-block` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress
3. Add the "AgilePress Schema JSON-LD Block" block to any post or page
4. Configure your JSON-LD in the Block Sidebar
5. Publish and verify your structured data using Google's Rich Results Test

== Frequently Asked Questions ==

= Does this block work with ACF (Advanced Custom Fields)? =

Yes! The block fully supports ACF custom fields using the `{{acf:field_name}}` placeholder syntax. It handles both string and array field types safely.

= How do I validate my JSON-LD? =

The block includes real-time validation that displays "Valid JSON" or "Invalid JSON" status in the sidebar as you edit. You can also use Google's Rich Results Test or Schema.org validator for external verification.

= Can I use multiple schema blocks on one page? =

Yes, you can add multiple AgilePress Schema JSON-LD Block blocks to a single page. Each will output its own separate JSON-LD script tag.

= Where does the JSON-LD appear on my site? =

The structured data is injected into the `<head>` section of your page via `wp_head`, making it invisible to visitors but perfectly readable by search engines.

= What if I want to add custom schema types? =

Start with the "Blank" template and paste in your custom JSON-LD schema. The block will validate it and process any placeholders you include.

== Screenshots ==

1. Clean editor placeholder showing "JSON-LD Configured" status
2. Block Sidebar with template selector and JSON-LD editor
3. Real-time validation feedback
4. Example LocalBusiness template with placeholders

== Changelog ==

= 0.1.0 =
* Initial release
* Template library with LocalBusiness, Organization, and FAQ schemas
* Dynamic placeholder replacement for WordPress core and ACF fields
* Real-time JSON validation
* Clean wp_head injection without extra markup

== Technical Details ==

The block uses a dynamic rendering approach with `render_callback` to process placeholders server-side. This ensures that:

* Placeholders are replaced with current data on every page load
* ACF fields are safely accessed and formatted
* Invalid JSON never reaches the frontend
* Search engines receive clean, valid JSON-LD markup

The frontend output is optimized with no extra paragraph or break tags, outputting only the pure JSON-LD script tag.
