Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › result list file names truncated › Reply To: result list file names truncated
Hi,
The plugin does not truncate the titles. The issue is, that wordpress automatically generates the attachment titles, and it truncates the file extensions. The plugin then requests this title, it is already stored that way. I think there is still a way to get the file name based on the storage path and override the titles in the results via custom code.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter( 'asp_results', 'asp_get_file_name_res', 10, 1 );
function asp_get_file_name_res($results) {
foreach ( $results as $k => &$r ) {
if ( $r->content_type == 'attachment' ) {
$r->title = basename ( get_attached_file( $r->id ) );
}
}
return $results;
}
I could not test this code, so please be careful. Hopefully it should change the titles in the live results list.