Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › result list file names truncated
- This topic has 3 replies, 2 voices, and was last updated 6 years, 2 months ago by
Ernest Marcinko.
-
AuthorPosts
-
March 21, 2020 at 8:46 pm #26337
nathan96753
ParticipantGreetings,
We are using AjaxSearch on https://makenasurf.org/historical-meeting-minutes/
In the results list, file names are often truncated, usually at the first ‘.’ character. We need the results list to show the complete file names:
In the attached screenshot, in a search for ‘Nathan’. the fourth result shows “Makena-Surf-Annual-2019” when it should show “Makena-Surf-Annual-2019.02.23-draft” ( the file name is Makena-Surf-Annual-2019.02.23-draft.pdf )
Any help or advice is appreciated.
Stay safe and healthy !
Best,
NathanMarch 22, 2020 at 11:11 am #26343Ernest Marcinko
KeymasterHi,
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.
April 3, 2020 at 8:05 pm #26573nathan96753
ParticipantThank You Ernest,
We tried this Conde and didnt see any difference in the results list. This is curious because it worked fine up to about 3 months ago.
Any other suggestions for us?
Thanks and stay safe!
Best,
NathanApril 4, 2020 at 11:47 am #26577Ernest Marcinko
KeymasterHi Nathan,
Wordpress most likely changed something there, there was no change in our plugin, regarding the titles.
Using the custom code is the only option here I’m afraid. If you want, you can add temporary FTP details, and I will try to test it out.
-
AuthorPosts
- You must be logged in to reply to this topic.