WP Manifestindependent plugin directory
manifest / utilities / syllable-hyphenator

Syllable Hyphenator WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA

Server-side hyphenation for WordPress with Syllable library.

★ 12stars
255release downloads
≈10active sites
v1.1.0latest · 3 years ago

Install

Download syllable-hyphenator.zip From the v1.1.0 release on GitHub, May 20, 2023

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/joppuyo/syllable-hyphenator/releases/download/v1.1.0/syllable-hyphenator.zip
Updates itself. It ships its own updater (Plugin Update Checker), so new versions appear under Dashboard → Updates.

Screenshot of two WordPress pages. Normal on the left, hyphenated on the right

Server-side hyphenation for WordPress with Syllable library. It works by inserting ­ or "soft hyphen" characters to your strings so browsers will hyphenate the words correctly for you.

Compatiblity

  • PHP 7 +
  • WordPress 5.0 +
  • (Optional) Timber 1.10.0 +
  • (Optional) Polylang

Installation

  1. Download latest version on the Releases page.
  2. Upload plugin on the WordPress plugin admin page.
  3. Activate plugin.
  4. See section below on how to use the plugin in your theme

Usage

You can use the syllable_hyphenate WordPress filter to hyphenate text.

echo '<h1>' . apply_filters('syllable_hyphenate', get_the_title($post)) . '</h1>';

If you are using Timber, you can also use the hyphenate Twig filter,

<h1>{{ post.title | hyphenate }}</h1>

You can use the syllable_hyphenate_html filter to hyphenate a HTML string. For example, let's say you want to hyphenate output of Heading Gutenberg blocks. You can do it with the following code:

add_filter('render_block', function ($content, $block) {
    if ($block['blockName'] === 'core/heading') {
        $content = apply_filters('syllable_hyphenate_html', $content);
    }
    return $content;
}, 10, 2);

Filters

Minimum word length

syllable_hyphenator_min_word_length

By default, minimum word length for hyphenation is set to 12 characters. This prevents awkward hyphenation of very short words.

add_filter('syllable_hyphenator_min_word_length', function () {
  return 6;
});

WordPress locale

syllable_hyphenator_wp_locale

Language used for hyphenation. By default this is the language specified in the WordPress settings page. This can be overridden using this filter. The locale should be in WordPress locale format, for example en_US.

add_filter('syllable_hyphenator_wp_locale', function () {
  return 'en_US';
});

Current language

syllable_hyphenator_current_locale

This overrides the WordPress language. This is useful if you have different language content on your site. If Polylang is installed, the current Polylang post language will be used. Return value should be in Syllable library format, for example en-us.

add_filter('syllable_hyphenator_current_locale', function () {
  return 'en-us';
});

Releases

5 releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.1.0 latest
May 20, 2023 3 years ago
syllable-hyphenator.zip
174
Sep 20, 2020 6 years ago
syllable-hyphenator.zip
58
Sep 20, 2020 6 years ago
syllable-hyphenator.zip
7
Sep 17, 2020 6 years ago
syllable-hyphenator.zip
6
Sep 15, 2020 6 years ago
syllable-hyphenator.zip
10

Active-site estimate ≈10 comes from the median of recent superseded releases. Method.

A grade

Security

Syllable Hyphenator 1.1.0 · audited by WP Registry

No security issues found.

Audited release
1.1.0
Findings
none
Worst severity
—
Content hash
560024bcd5b3d84c42a703d8…

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.