Improve story index page templates

This commit is contained in:
Tetrakern 2024-07-14 22:57:02 +02:00
parent 7a4ca77d4a
commit 7ec5ffbe0f
2 changed files with 4 additions and 4 deletions

View File

@ -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 '#'
}

View File

@ -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 '#'
}