Perun
2/9/2016 - 4:22 PM

Die einfachen und die doppelten Anführungszeichen durch die einfachen bzw. doppelten "Anführungszeichen" ersetzen. Ist zwar typographisch ni

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 );
?>