WP Manifestindependent plugin directory
manifest / editor / wp-balance-text

Balance Text

WordPress plugin: adds a Balance toggle to the native Typography panel on every block. Applies CSS text-wrap: balance via a single className. One editor.BlockEdit filter, composes with any block style variation.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/diffyweb/wp-balance-text/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A tiny WordPress plugin that adds a Balance toggle to the native Typography panel on every block. Applies CSS text-wrap: balance via a single className.

What it does

Two ways to apply CSS text-wrap: balance to your content:

  1. Per-block toggle. Slots a one-click control into the editor's native Typography panel — same panel that holds Size, Font, Drop cap, Fit text, etc. Click + in the panel header → enable Balance on the selected block.
  2. Site-wide defaults. Settings → Balance Text: pick block types that should be balanced by default. Out of the box, headings H1–H6 are on (matching the common convention). Optional: Paragraph, Quote, Pullquote, Verse. A "Settings" link also appears next to Activate/Deactivate on the Plugins screen.

Result: headlines and short paragraphs stop stranding a single word on the last line. Per-block toggles compose cleanly with the site-wide defaults — they're additive opt-in, not overrides.

How it works

  • One editor.BlockEdit filter, fires for every block type. No per-block-type registration.
  • Storage is a text-balance token pushed onto the block's existing className attribute. No custom attributes, no migrations, no lock-in.
  • CSS is enqueued via wp_enqueue_block_assets so the editor preview matches the front-end.
  • Composes with any is-style-* block style variation already applied.

Files

wp-balance-text.php   # plugin header, enqueues, Settings API, dynamic <style> emitter
assets/editor.js      # the Typography-panel toggle (one editor.BlockEdit filter)
assets/style.css      # .text-balance + .balance-text utility classes

That's the whole plugin.

Installation

  1. Clone or download into /wp-content/plugins/wp-balance-text/.
  2. Activate via the Plugins screen (or wp plugin activate wp-balance-text).
  3. Open any block in the editor → Typography panel → click the + menu → enable Balance.

Requirements

  • WordPress 6.4+ (for the stable ToolsPanelItem slot; gracefully falls back to the experimental version on older builds).
  • PHP 7.4+.
  • Modern browser for the text-wrap: balance rule itself (Chrome 114+, Edge 114+, Firefox 121+, Safari 17.5+). Older browsers ignore the rule and fall back to default wrapping — no breakage.

License

GPL-2.0-or-later. See LICENSE.