Extra Sentence Space
- Author:Scott Reilly
- Version:1.2.6
- Last update:2012-12-11
- Compatibility:WP 1.5 – 3.5.1
- Comments:go here
- Download:[ zip ]
- Description:
Force browsers to display two spaces (when present) between sentences.
-
Extended Description
Force browsers to display two spaces (when present) between sentences.
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 | Author Homepage
Find out more at the plugin’s WordPress Plugin Repository page.
Installation
- Unzip
extra-sentence-space.zipinside the/wp-content/plugins/directory (or install via the built-in WordPress plugin installer) - Activate the plugin through the ‘Plugins’ admin menu in WordPress
- Begin (or continue) to use two spaces to separate your sentences when writing a post.
- Unzip
-
Filters
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:
add_filter( 'c2c_extra_sentence_space_punctuation', 'more_extra_space_punctuation' ); function more_extra_space_punctuation( $punctuation ) { // Adding the '/' and ')' characters to the list of characters return $punctuation . '/)'; }
Frequently Asked Questions
Q. What text does this plugin modify (aka filter)?
A. This plugin potentially modifies the post content, excerpt, title, comment text, and widget text.Q. Why do my sentences still appear to be separated by only one space despite the plugin being active?
A. Did you use two spaces to separate the sentences when you wrote the post? This plugin only retains the appearance of those two spaces when the post is viewed in a browser; it does not insert a second space if there wasn’t one originally present.Q. Can I enforce double-spacing after other types of punctuation?
A. Yes. See the Filters section for an example of the code you’ll need to use.
Release Log
1.2.6
- Add check to prevent execution of code if file is directly accessed
- Note compatibility through WP 3.5+
- Update copyright date (2013)
1.2.5
- Re-license as GPLv2 or later (from X11)
- Add ‘License’ and ‘License URI’ header tags to readme.txt and plugin file
- Remove ending PHP close tag
- Note compatibility through WP 3.4+
- Minor code reformatting (indentation)
- Update copyright date (2012)
1.2.4
- Note compatibility through WP 3.3+
1.2.3
- Note compatibility through WP 3.2+
- Tiny code formatting change (spacing)
- Fix plugin homepage and author links in description in readme.txt
1.2.2
- Add link to plugin homepage to description in readme.txt
1.2.1
- Note compatibility with WP 3.1+
- Update copyright date (2011)
1.2
- Add filter ‘c2c_extra_sentence_space_punctuation’ to allow customization of the punctuation after which double-spacing (when present) is preserved. Default is ‘.!?’
- Add filter ‘c2c_extra_sentence_space’ to respond to the function of the same name so that users can use the apply_filters(‘c2c_extra_sentence_space’) notation for invoking function
- Wrap function in if (function_exists()) check
- Note compatibility with WP 3.0+
- Minor code reformatting (spacing)
- Remove docs from top of plugin file (all that and more are in readme.txt)
- Remove trailing whitespace in header docs
- Add Filters and Upgrade Notice sections to readme.txt
1.1
- Also filter ‘widget_text’
- Now also filter widget_text
- Add PHPDoc documentation
- Note compatibility with WP 2.8+ and 2.9+
- Update readme.txt (including adding Changelog)
1.0.1
- Note compatibility with WP 2.6+ and 2.7+
- Update copyright date
- Tweak description and extended description
- Remove commented out line of code that could be used to insert a second space if two aren’t present
- Update and fix some mis-worded sentences in readme.txt
1.0
- Initial release
Copyright & Disclaimer
Copyright © 2009-2012 by Scott Reilly (aka coffee2code)Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
