Hi,
This is not a feature that the plugin anticipates, and so it might be complex to set up how you want it, or possibly not doable at all.
I think you can possibly use either:
a_z_listing_item_index_letter
to override the index letter, but leave the title unchanged, or
a_z_listing_pre_index_item_title
to change the title
For the first option something like this in your theme’s functions.php
might work:
<?php
add_filter( 'a_z_listing_item_index_letter', 'override_a_z_index_letter' );
function override_a_z_index_letter( $original_index, $item, $type ) {
$surname = get_post_meta( $item->ID, 'surname', true );
if ( $surname ) {
return array( \A_Z_Listing\Strings::maybe_mb_substr( $surname, 0, 1 ) );
}
return $original_index;
}
For the second option, something like this in your theme’s functions.php
might work:
<?php
add_filter( 'a_z_listing_pre_index_item_title', 'override_a_z_title' );
function override_a_z_title( $original_title, $item, $type ) {
$surname = get_post_meta( $item->ID, 'surname', true );
if ( $surname ) {
return $surname;
}
return $original_title;
}