Extra Sentence Space

plugin banner

Version: 1.2.5

Force browsers to display two spaces (when present) between sentences.

Author:Scott Reilly (profile at wordpress.org)
WordPress version required:1.5
WordPress version tested:5.3.3
Plugin version:1.3.9
Added to WordPress repository:11-06-2009
Last updated:01-01-2020
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:60
Rated by:2
Plugin URI:http://coffee2code.com/wp-plugins/extra-sente...
Total downloads:9 489
Active installs:80+
plugin download
Click to start download

Even though you may add two spaces after each sentence when writing a post (assuming you subscribe to a writing style that suggests such spacing) web browsers will collapse consecutive blank spaces into a single space when viewed. This plugin adds a   (non-breaking space) after sentence-ending punctuation to retain the appearance of your two-space intent.

NOTE: The plugin will only enforce the two-space gap in places where two or more spaces actually separate sentences in your posts. It will NOT insert a second space if only one space is present.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Hooks

The plugin is further customizable via two filters. Typically, these customizations would be put into your active theme’s functions.php file, or used by another plugin.

c2c_extra_sentence_space

The ‘c2c_extra_sentence_space’ filter allows you to use an alternative approach to safely invoke c2c_extra_sentence_space() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site. This only applies if you use the function directly, which is not typical usage for most users.

Example:

Instead of:

<?php echo c2c_extra_sentence_space( $mytext ); ?>

Do:

<?php echo apply_filters( 'c2c_extra_sentence_space', $mytext ); ?>

c2c_extra_sentence_space_punctuation

The ‘c2c_extra_sentence_space_punctuation’ filter allows you to customize the punctuation, characters, and/or symbols after which double-spacing (when present) is preserved. By default these are ‘.!?’.

Arguments:

  • $punctuation (string): The default characters after which double-spacing should be preserved. Default is ‘.!?’.

Example:

/**
 * Modifies the list of characters after which two spaces should be preserved
 * to include a forward slash.
 *
 * @param string $punctuation The punctuation.
 * @return string
 */
function more_extra_space_punctuation( $punctuation ) {
    // Add the '/' and ')' characters to the list of characters
    return $punctuation . '/)';
}
add_filter( 'c2c_extra_sentence_space_punctuation', 'more_extra_space_punctuation' );

FAQ
ChangeLog