Skip to content

Instantly share code, notes, and snippets.

@janzikmund
Created April 21, 2018 09:26
Show Gist options
  • Save janzikmund/9dff30abbf7d58f630a81579f9ca0c0f to your computer and use it in GitHub Desktop.
Save janzikmund/9dff30abbf7d58f630a81579f9ca0c0f to your computer and use it in GitHub Desktop.
Fixes Ubuntu font not showing quotes properly
<?php
// replace content filtered entities back, as certain characters are not defined in Ubuntu font
add_filter('the_content', 'sw_replace_quotes_back', 100);
add_filter('wpp_post', 'sw_replace_quotes_back', 100);
add_filter('acf/load_value', 'sw_replace_quotes_back', 100);
add_filter('acf/format_value_for_api', 'sw_replace_quotes_back', 100);
add_filter('the_title', 'sw_replace_quotes_back', 100);
function sw_replace_quotes_back($str) {
$search = array('&#8217;', '’', '&#8220;', '&#8221;', '“', '”');
$replace = array("&#39;", "&#39;", '&#34;', '&#34;', '&#34;', '&#34;');
$str = str_replace($search, $replace, $str);
return $str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment