Avoid Typography Widows or Orphans

by | Jun 11, 2021 | Technical Help

add the following to functions file

/**
* Avoid Typography Widows
*/
function kl_avoid_content_widows( $content ) {
$pattern = ‘@(?:\s)([[:punct:][:word:]]+)(?:\s)(?!/>)([[:punct:][:word:]]+)(?:\s)([[:punct:][:word:]]+)@m’;
$replacement = ‘ $1 $2 $3‘;
$content = preg_replace( $pattern, $replacement, $content, -1 );

return $content;
}
add_filter( ‘the_content’, ‘kl_avoid_content_widows’ );

CLICK HERE to find your domain name!   CLICK HERE to transfer your domain name!

Resource Categories

Archives