Skip to content

Instantly share code, notes, and snippets.

@dtbaker
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtbaker/24ed45dd769be2953472 to your computer and use it in GitHub Desktop.
Save dtbaker/24ed45dd769be2953472 to your computer and use it in GitHub Desktop.
WordPress RTL bracket hack fix using JavaScript
function dtbaker_rtl_bracket_js_hack() {
?>
<script type="text/javascript">
(function($){
$('p:contains(")")').each(function(){
$(this).html($(this).html().replace(/\)(\s*)$/,')&#x200E;\1').replace(/^(\s*)\(/,'\1&#x200E;('));
});
})(jQuery);
</script>
<?php
}
if(is_rtl()){
add_action('wp_footer', 'dtbaker_rtl_bracket_js_hack');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment