Attachment filename

Home Forums Legacy Support Support queries Other issues Attachment filename

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #268106
    musa_ajk
    Participant
    Hello. 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=0  
    #268328
    Veronica
    Moderator
    hi, the delay in response due to holiday please refer: https://wplms.io/support/knowledge-base/rename-unit-attachment-file-name/
    #269636
    musa_ajk
    Participant
    Hi 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.
    #269838
    Veronica
    Moderator
    ok 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.
    #271265
    musa_ajk
    Participant
    Hi Veronica. Thanks for reply. Did you manage to have a look into the code for this?  
    #271515
    Jackson
    Blocked
    Hello, Today @varonica is on leave, she replied you on same tomorrow, Thanks,
    #272207
    musa_ajk
    Participant
    Thanks @Jackson. @Veronica, many thanks for your efforts, much appreciated. Did you manage to find a solution to this?
    #272253
    Veronica
    Moderator
    hi, 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); });
    #272940
    musa_ajk
    Participant
    Hi 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.
    #272947
    musa_ajk
    Participant
    Hi 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.
Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Attachment filename’ is closed to new replies.