Skip to content

Instantly share code, notes, and snippets.

@Perun
Last active February 10, 2016 13:37
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 Perun/2ba6fdce4de6d942df19 to your computer and use it in GitHub Desktop.
Save Perun/2ba6fdce4de6d942df19 to your computer and use it in GitHub Desktop.
Die einfachen und die doppelten Anführungszeichen durch die einfachen bzw. doppelten "Anführungszeichen" ersetzen. Ist zwar typographisch nicht wirklich richtig, aber erleichtert die Eingabe von Code-Beispielen und verhindert auch ein paar kleinere Bugs. Ursprünglichen Code hier gefunden: https://gist.github.com/Zodiac1978/1e33b0f58db8333f5f0b
<?php
// Anführungszeichen
function gerade_anfuehrungszeichen( $translations, $text, $context, $domain ) {
if ( 'opening curly single quote' == $context && '&#8216;' == $text ) {$translations = '&#39;';}
if ( 'closing curly single quote' == $context && '&#8217;' == $text ) {$translations = '&#39;';}
if ( 'opening curly double quote' == $context && '&#8220;' == $text ) {$translations = '&#34;';}
if ( 'closing curly double quote' == $context && '&#8221;' == $text ) {$translations = '&#34;';}
return $translations;
}
add_filter( 'gettext_with_context', 'gerade_anfuehrungszeichen', 10, 4 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment