Exclude non alphanumeric characters – again
-
Hi.
Trying to implement solution from here:<?php add_filter( 'a_z_listing_item_index_letter', 'ignore_quotes_in_a_z' 10, 3 ); function ignore_quotes_in_a_z( $indices, $item, $item_type ) { $title = get_the_title( $item ); for ( $i = 0; $i < strlen( $title ); $i++ ) { $letter = substr( $title, $i, 1 ); switch ( $letter ) { // add all the characters you want to ignore here - switch falls-through // so if any one of these are matched we hit the break; and continue // to the next letter in the title. case '"': case '\'': case '(': case '[': break; // if none of the above match then we use the character as the index default: return [ $letter ]; } } // This is here to handle the case of the above code not giving an index return $indices; }
by inserting into child theme functions.php but getting errors.
Any advice for a tech knuckle-head most appreciated.
Many thanks
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Exclude non alphanumeric characters – again’ is closed to new replies.