=== Simple Star Rating Block ===
Contributors: martin7ba
Tags: block, star rating, Gutenberg, custom fields, reviews
Tested up to: 7.1
Stable tag: 0.3
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Development Version: https://github.com/martinjankov/simple-star-rating-block

A lightweight, accessible Gutenberg block for star ratings — enter a value manually or pull it live from a custom field (ACF supported).

== Description ==

**Show a star rating anywhere, in seconds.** Drop the Simple Star Rating Block into any post, page, or custom post type, set a value from 0 to 5 (half and decimal values render as partial stars), and style it to match your site. Ideal for product reviews, recipe ratings, testimonials, and comparison posts.

Ratings can be typed in manually or **pulled dynamically from a custom field** — including ACF fields — so a rating stored on the post updates the block automatically. Inside a Query Loop, the block always shows the rating of the correct post.

Development Version can be found on: https://github.com/martinjankov/simple-star-rating-block

### Features:

- **Manual or dynamic:** Type a rating, or bind the block to a custom field on the post — works with custom post types, including those using a custom REST base.
- **ACF Integration:** Pull the rating from an ACF field — just enable "Show in REST" on the ACF Field Group (see screenshot 4).
- **Partial stars:** Decimal ratings like 4.3 render as precisely filled stars.
- **Accessible:** Screen readers announce a clear "Rated 4.5 out of 5" label instead of empty markup.
- **Your style:** Adjust star color and size per block; the stars scale with your typography.
- **Featherweight:** A few hundred bytes of CSS, no external assets, no JavaScript on the front end.

== Installation ==

To install the Simple Star Rating Block plugin, follow these steps:

1. **Upload:** Upload the plugin files to the `/wp-content/plugins/simple-star-rating-block` directory.
2. **Activate:** Activate the plugin through the 'Plugins' screen in WordPress.
3. **Configuration:** Configure the settings to suit your needs via the Gutenberg block settings.

== Frequently Asked Questions ==

= How do I add a star rating to a post, page or custom post type? =

Simply add the "Star Rating Block" from the Gutenberg block inserter, then set your desired rating or link it to a custom field.

= Can I customize the appearance of the star ratings? =

Yes, you can customize the size, color, and style of the stars through the block settings in the Gutenberg editor.

= I don't see ACF fields in the Custom Field Key List? =

To see the ACF fields in the list you need to enable the ACF Group where the field is to show in the REST API. See screenshot 4 on how to do that.

== Screenshots ==

1. **Star Rating Block in Action:** Demonstrates the star rating block as displayed on a post or page.
2. **Block Settings Panel:** Shows the settings available for customizing the star rating block.
3. **Star Rating Block in Action In Post Context:** Demonstrates the star rating block as displayed on a post or page.
4. **Enable Option for ACF Group to pull rating from ACF Field :** Enable "Show in REST" so that the ACF Group can show in the Fields list on the Simple Star Rating Block

== Changelog ==

= 0.3 =

- Accessibility: the block now renders with `role="img"` and a "Rated X out of 5" label; individual stars are hidden from screen readers
- Fixed invalid HTML on the frontend (block-level elements inside an inline wrapper)
- Ratings are now clamped to the 0–5 range, including values pulled from custom fields
- Correct post is now used when the block renders inside a Query Loop
- Custom fields now load correctly in the editor for custom post types with a custom REST base
- Performance: removed ~13KB of unused CSS from the frontend stylesheet
- Hardened inline style output
- Compatibility: tested up to WordPress 7.1
  _Release Date - 30 July 2026_

= 0.2 =

- Bug fix where default custom fields were not showing in the list
  _Release Date - 03 January 2025_

= 0.1.1 =

- Enabled to successfully pull custom fields from Custom Post Types
  _Release Date - 11 August 2024_

= 0.1.0 =

- Initial release
  _Release Date - 07 July 2024_

== Arbitrary section ==

### Additional Information:

For more advanced usage, you can hook into the block’s filters and actions to extend its functionality. This is particularly useful for developers who want to integrate the star ratings with other plugins or custom code.

### Support:

If you encounter any issues or have questions, please contact us directly at [martin@martincv.com](mailto:martin@martincv.com).
