Home › Forums › Legacy Support › Support queries › Other issues › Attachment filename
Tagged: Unit attachments
- This topic has 9 replies, 3 voices, and was last updated 4 years, 5 months ago by musa_ajk.
Viewing 10 posts - 1 through 10 (of 10 total)
-
AuthorPosts
-
June 14, 2020 at 2:18 pm #268106musa_ajkParticipantHello. We currently have uploaded unit attachments showing as thumbnails. We would like to display the unit attachmentrs with the corresponding filename, or just the filename on it's own. Please see link for screenshot. Thanks in advance. https://www.dropbox.com/s/qu7bubr1c6djpcm/attachments2.jpg?dl=0June 15, 2020 at 1:15 pm #268328VeronicaModeratorhi, the delay in response due to holiday please refer: https://wplms.io/support/knowledge-base/rename-unit-attachment-file-name/June 20, 2020 at 4:20 pm #269636musa_ajkParticipantHi Veronica. Many thanks for your reply and apologies in the delay this side. In the link you posted, the screenshot actually shows the filename, for us it shows the thumbnail. The thumbnail on it's own is not very informative, so we need the thumbnail and filename to be shown, or just the filename on it's own. Thanks.June 22, 2020 at 12:39 pm #269838VeronicaModeratorok please give me some time i will take a look in the code and then let you know so please ping me for the same.June 27, 2020 at 8:16 pm #271265musa_ajkParticipantHi Veronica. Thanks for reply. Did you manage to have a look into the code for this?June 29, 2020 at 10:41 am #271515JacksonBlockedHello, Today @varonica is on leave, she replied you on same tomorrow, Thanks,July 2, 2020 at 12:58 am #272207musa_ajkParticipantThanks @Jackson. @Veronica, many thanks for your efforts, much appreciated. Did you manage to find a solution to this?July 2, 2020 at 4:56 am #272253VeronicaModeratorhi, Please try adding this given code in your wplms-customizer.php file in wplms customizer plugin : add_action(‘wplms_before_every_unit’,function(){ add_filter(‘wp_get_attachment_link’,function($link,$id,$size,$permalink,$icon,$text,$attr) { $_post = get_post( $id ); if ( empty( $_post ) || ( ‘attachment’ !== $_post->post_type ) || ! wp_get_attachment_url( $_post->ID ) ) { return __( ‘Missing Attachment’ ); } $url = wp_get_attachment_url( $_post->ID ); if ( $permalink ) { $url = get_attachment_link( $_post->ID ); } $link_text = $_post->post_title; if ( ‘’ === trim( $link_text ) ) { $link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) ); } return “$link_text“; },999999,7); });July 5, 2020 at 12:37 am #272940musa_ajkParticipantHi Veronica. Thanks for the code, unfortunately the thumbnails still shows instead of the filename. I positioned the code in various parts of the file but to no avail. Please advise.July 5, 2020 at 1:49 am #272947musa_ajkParticipantHi Verinica. (Sorry, Let's try that again)... Something most unusual. The error below is being generated, and upon close inspection of the code added it "seems" system is missing out bits of code. I presume your code is OK. Please advise. e.g. line in question: (viewed in cPanel): if ( empty( $_post ) ||attachment!== $_post->post_type ) || ! wp_get_attachment_url( $_post->ID ) ) { return __Missing Attachment; (viewed in FTP): if ( empty( $_post ) || ( ‘attachment’ !== $_post->post_type ) || ! wp_get_attachment_url( $_post->ID ) ) { return __( ‘Missing Attachment’ ); Error: Parse error: in /var/www/virtual/sais.org.uk/htdocs/wordpress/wp-content/plugins/wplms-customizer/wplms-customizer.php on line 38 There has been a critical error on your website.
-
AuthorPosts
Viewing 10 posts - 1 through 10 (of 10 total)
- The topic ‘Attachment filename’ is closed to new replies.