=== Orphans === Contributors: iworks Donate link: https://ko-fi.com/iworks?utm_source=sierotki&utm_medium=readme-donate Tags: grammar, conjunction, typography, polish, czech, orphan, nbsp Requires at least: 5.0 Tested up to: 6.3 Stable tag: 3.2.4 Requires PHP: 7.4 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.html Supports the grammar rule for orphan words at the end of a line. == Description == To avoid line breaks in the incorrect position, the plugin fixes orphans' positions and replaces space after orphan with a hard space.  **Orphan** - a text composition error, which consists in leaving a lonely short word at the end or at the beginning of a verse, especially a single-character one. The word "lonely" here means separation from a closely related word by line breaks. = Asset image = [Manuscript by Muffet, on Flickr](http://www.flickr.com/photos/calliope/306564541/) = GitHub = The Orphans plugin is available also on [GitHub - Orphans](https://github.com/iworks/sierotki). == Installation == There are 3 ways to install this plugin: = The super easy way = 1. **Log in** to your WordPress Admin panel. 1. **Go to: Plugins > Add New.** 1. **Type** ‘orphans’ into the Search Plugins field and hit Enter. Once found, you can view details such as the point release, rating and description. 1. **Click** Install Now. After clicking the link, you’ll be asked if you’re sure you want to install the plugin. 1. **Click** Yes, and WordPress completes the installation. 1. **Activate** the plugin. 1. A new menu `Orphans` in `Appearance` will appear in your Admin Menu. *** = The easy way = 1. Download the plugin (.zip file) on the right column of this page. 1. In your Admin, go to the menu Plugins > Add. 1. Select the button `Upload Plugin`. 1. Upload the .zip file you just downloaded. 1. Activate the plugin. 1. A new menu `Orphans` in `Appearance` will appear in your Admin Menu. *** = The old and reliable way (FTP) = 1. Upload `sierotki` folder to the `/wp-content/plugins/` directory. 1. Activate the plugin through the 'Plugins' menu in WordPress. 1. A new menu `Orphans` in `Appearance` will appear in your Admin Menu. == Frequently Asked Questions == = When does this plugin replace spaces? = Plugin works when viewing the content and does not modify your content. = I have a problem with the plugin, or I want to suggest a feature. Where can I do this? = You can do it on [Support Threads](https://wordpress.org/support/plugin/sierotki/#new-topic-0), but please add your ticket to [Github Issues](https://github.com/iworks/sierotki/issues). = How to use this plugin on the custom field? = Use `orphan_replace` filter. Example code: ` $value = apply_filters( 'orphan_replace', get_post_meta($post_id, 'meta_key', true ) ); ` = How to use this plugin on any string? = Use `orphan_replace` filter. Example code: ` $value = apply_filters( 'orphan_replace', 'any string' ); ` = How to change plugin capability? = By default to using this plugin you must have `manage_options` capability, which usually means site administrator. If you want to allow manage Orphans by "Editors" then you need to use other capabilities, e.g. `unfiltered_html`. You can use `iworks_orphans_capability` filter: ` add_filter('iworks_orphans_capability', 'my_orphans_capability'); function my_orphans_capability($capability) { return 'unfiltered_html'; } ` = How to turn of replacement in my piece of code? = At the beginning of your block just add: ` add_filter( 'orphan_skip_replacement', '__return_true' ); ` and at the end, to again turn on replacements: ` remove_filter( 'orphan_skip_replacement', '__return_true' ); ` = How can I change default orphans? = Please use `iworks_orphan_terms` filter. It is array of default orphans. You can remove, add or even replace whole array. For example, to remove words "oraz", "na" and ""nie", use code bellow: ` add_filter( 'iworks_orphan_terms', 'remove_iworks_orphan_terms' ); function remove_iworks_orphan_terms( $terms ) { $default_orphans_to_remove = array( 'oraz', 'na', 'nie', ); foreach( $default_orphans_to_remove as $value ) { if ( $key = array_search( $value, $terms ) ) { unset( $terms[ $key ] ); } } return $terms; } ` = How can I change the default orphan file? = The default file with definitions is located in the `etc/` directory. You can change it using the filter `iworks_orphan_own_terms_file`: ` add_filter( 'iworks_orphan_own_terms_file', function( $file ) { return '" as char before a orphan. = 1.0.1 - 2011-02-16 = * NEW: Added word "to". = 1.0 - 2011-02-16 = * INIT == Upgrade Notice == = 3.1.0 - 2023-03-06 = Switching from simple replacement to DOMDocument parsing and string replacement could cause problems for your sites if there are missing required PHP modules.