diff --git a/singular-index-advanced.php b/singular-index-advanced.php index 01ee9cf6..825e5457 100644 --- a/singular-index-advanced.php +++ b/singular-index-advanced.php @@ -42,10 +42,10 @@ if ( $stories->have_posts() ) { // Relevant data $title = trim( fictioneer_get_safe_title( $story_id, 'story_index' ) ); - $first_char = strtolower( mb_substr( $title, 0, 1, 'UTF-8' ) ); + $first_char = mb_strtolower( mb_substr( $title, 0, 1, 'UTF-8' ), 'UTF-8' ); // Normalize for numbers and other non-alphabetical characters - if ( is_numeric( $first_char ) ) { + if ( ! preg_match( '/\p{L}/u', $first_char ) ) { $first_char = '#'; // Group under '#' } diff --git a/singular-index.php b/singular-index.php index 3dd019f9..8f73d945 100644 --- a/singular-index.php +++ b/singular-index.php @@ -42,10 +42,10 @@ if ( $stories->have_posts() ) { // Relevant data $title = trim( fictioneer_get_safe_title( $story_id, 'story_index' ) ); - $first_char = strtolower( mb_substr( $title, 0, 1, 'UTF-8' ) ); + $first_char = mb_strtolower( mb_substr( $title, 0, 1, 'UTF-8' ), 'UTF-8' ); // Normalize for numbers and other non-alphabetical characters - if ( is_numeric( $first_char ) ) { + if ( ! preg_match( '/\p{L}/u', $first_char ) ) { $first_char = '#'; // Group under '#' }