Skip to content

Instantly share code, notes, and snippets.

@danielstrelec
Last active December 16, 2019 15:11
Show Gist options
  • Save danielstrelec/7981dc1750c74c7ff14d9fd7aee74866 to your computer and use it in GitHub Desktop.
Save danielstrelec/7981dc1750c74c7ff14d9fd7aee74866 to your computer and use it in GitHub Desktop.
<?php
// pevné mezery za spojky
function wt_conjunctions( $content ) {
$content = str_replace(
array(
' a ', ' A ',
' i ', ' I ',
' k ', ' K ',
' o ', ' O ',
' s ', ' S ',
' u ', ' U ',
' v ', ' V ',
' z ', ' Z '
),
array(
' a&nbsp;', ' A&nbsp;',
' i&nbsp;', ' I&nbsp;',
' k&nbsp;', ' K&nbsp;',
' o&nbsp;', ' O&nbsp;',
' s&nbsp;', ' S&nbsp;',
' u&nbsp;', ' U&nbsp;',
' v&nbsp;', ' V&nbsp;',
' z&nbsp;', ' Z&nbsp;'
),
$content );
return $content;
}
// standarní WordPress pole
add_filter( 'the_title', 'wt_conjunctions' );
add_filter( 'the_content', 'wt_conjunctions' );
add_filter( 'the_excerpt', 'wt_conjunctions' );
// ACF pole
add_filter( 'acf/format_value/type=text', 'wt_conjunctions', 10, 3 );
add_filter( 'acf/format_value/type=textarea', 'wt_conjunctions', 10, 3 );
add_filter( 'acf/format_value/type=wysiwyg', 'wt_conjunctions', 10, 3 );
?>
@danielstrelec
Copy link
Author

Jednoduchá náhrada za plugin Zalomení pro WordPress. Přidá ke spojkám pevné mezery, aby nebyly na konci řádku.
Seznam lze kdykoliv upravit podle potřeby, ve spodní části lze upravit pro jaké pole se má projevit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment