Rating Bars for Bricks
A nestable Bricks element for labelled bars that fill to a value, for ratings, skills or results. The width is worked out on the server from the number shown, so it works with query loops and dynamic data.
Version: 0.1.0 · Requires: WordPress 6.0+, PHP 8.1+, Bricks · See the live demo
What it does
- Fills each bar to its value out of a full-bar number you choose: 100 for percentages, 5 for stars, 10 for scores.
- Reads the first number in the value, so 4.5 / 5, 92% and 1,200 all work.
- Three styles: bar, thin line, and ten segments.
- Fills when scrolled into view, and shows the final bars at once for visitors who prefer reduced motion.
- Moves the label and value above the bar when the space is narrow.
Installation
- Upload and activate the plugin. Bricks must be active.
- In the Bricks editor search for Rating Bars (General group).
Quick start
- Edit the label and the value in each row.
- Set Full bar is to match your values.
Using it in a loop, including an ACF repeater
The loop can be a post, term or user query, or a repeater such as an ACF repeater or a Meta Box group. For a repeater, choose it as the loop type on the item block, then use its sub-fields in the dynamic data. The demo includes an example built from an ACF repeater.
- Keep one row (the block with class
rb-row) and put the query loop on it. - Use dynamic data for the label and for the value, such as a custom field.
Settings
- Full bar is, Fill when scrolled into view, Fill time
- Stack label above the bar at (px) — default 420; 0 turns it off
- Style, bar and track colours, bar height and radius, label column width, row gap, label and value colours
Known limits
- Each value needs a number in it. A row with no number shows an empty bar.
- Values above the full-bar number are capped at a full bar.