This script removes widows from post titles in wordpress
This javascript file retrieves every post title by the class '.entry-title' and if the title is longer than three words, replaces the final space with a non-breaking space ( ).
- Use the class '.entry-title' in your HTML.
- Add this script to the footer of your document
<script src="widowfix.js"></script>
or add to your theme setup function
wp_enqueue_script( 'widowfix', get_template_directory_uri() . '/js/widowfix.js', array(), '0.0.1', true );