• Hi,

    I’m trying to find out how to add formatting for every link type to output as File_name (file_type, file_size)

    e.g.

    this_pdf_file (PDF, 300KB)
    this_word_doc (Word Document, 55KB)

    Currently in functions.php I have:
    function my_function( $formatted_file_size) {
    $formatted_file_size = str_replace ( “(” , “(PDF, ” , $formatted_file_size ) ;
    //$formatted_file_size = $formatted_file_size . ‘)’ ;
    return $formatted_file_size;
    }
    add_filter( ‘mtli_filesize’, ‘my_function’);

    But this just puts “PDF” for every attachment- I need it to change dynamically depending on file type.

    Not sure if this should go in functions.php or in singular.php or index.php.

    Cheers.

    https://www.ads-software.com/plugins/mimetypes-link-icons/

Viewing 1 replies (of 1 total)
  • The mtli_filesize filter does not have the file type information available, so you can’t do that from that filter.

    You could try to dynamically add it via Javascript maybe ?

Viewing 1 replies (of 1 total)
  • The topic ‘Adding (file type, file size) to every link’ is closed to new replies.