Ignoring “the” or adding an extra index entry for the first letter of the subsequent word after “the” will require you do do some PHP coding. There is a filter called a_z_listing_item_index_letter
that returns the letter(s) you want the item indexed under. This does not affect the sorting inside each letter section, so all the titles beginning with “The” in the T section will be grouped together.
Your filter will want to look similar to:
add_filter( 'a_z_listing_item_index_letter', 'add_extra_a_z_entry_for_titles_beginning_with_the', 10, 3 );
function add_extra_a_z_entry_for_titles_beginning_with_the( $indices, $item, $display) {
$title = apply_filters( "a_z_listing_get_item_title_for_display__{$display}", '', $item );
$title_parts = explode( ' ', $title );
if ( preg_match ( '^The$', $title_parts[0], 'i' ) && count( $title_parts ) > 1 ) {
// this line adds an extra index entry..
$indices[] = mb_substr( $title_parts[1], 0, 1 );
// this line replaces the existing index entry, for ignoring The entirely..
// $indices = array( mb_substr( $title_parts[1], 0, 1 ) );
}
return $indices;
}
Note this is a quick rough draft and will likely be broken – it is indended to be a jumping-off point for you to expand upon.
-
This reply was modified 2 years, 8 months ago by Dani Llewellyn. Reason: Add ignoring The in titles as an extra example