Last active
November 15, 2016 15:49
-
-
Save 2ndkauboy/ef5c62174871a03b3787f3936662fe53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Capitalize ẞ Dangit | |
* | |
* @package CapitalizeẞDangit | |
* @author Bernhard Kau | |
* @license GPLv3 | |
* | |
* @wordpress-plugin | |
* Plugin Name: Capitalize ẞ Dangit | |
* Plugin URI: https://kau-boys.com | |
* Description: Introduces a helper function you can use to capitalize the letter ß when surrounded by capital letters | |
* Version: 1.0.0 | |
* Author: Bernhard Kau | |
* Author URI: https://kau-boys.com | |
* License: GPLv3 | |
* License URI: http://www.gnu.org/licenses/gpl-3.0 | |
*/ | |
/** | |
* Capitalizes the letter ß when surrounded by capital letters | |
* | |
* @param string $text The text to be modified. | |
* | |
* @return string The modified text. | |
*/ | |
function capital_ß_dangit( $text ) { | |
return preg_replace( '/(\p{Lu})ß(\p{Lu})?/', '$1ẞ$2', $text ); | |
} | |
add_filter( 'the_content', 'capital_ß_dangit', 11 ); | |
add_filter( 'the_title', 'capital_ß_dangit', 11 ); | |
add_filter( 'wp_title', 'capital_ß_dangit', 11 ); | |
add_filter( 'comment_text', 'capital_ß_dangit', 31 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment