Support » Plugin: Download Monitor » Content Template to display mime-type icons?

  • Resolved gb24

    (@gb24)


    Has anyone developed a template to display a small mime-type icon next to each link in a list of file downloads? It would be helpful to display a small PDF icon next to each PDF file, or a DOCX icon next to each .docx file. For example:

    - A test pdf file (9 downloads) [PDF icon]
    - Word document file (10 downloads) [DOCX icon]
    - Another PDF file here (3 downloads) [PDF file icon]

    I’m aware of the Buttons extension, but that is much more than I want or need.

    Thank you

    • This topic was modified 1 year, 5 months ago by gb24.
    • This topic was modified 1 year, 5 months ago by gb24.
    • This topic was modified 1 year, 5 months ago by gb24.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    This is not a feature in our plugin. However, you should be able to setup icons based on file type by just using CSS.

    Harish, thank you for the reply.

    In the meantime I have created a new template based on an existing template (content-download-filename.php). The new template displays: icon, download title, number of downloads.

    <?php
    /**
     * Display file type icon, download title, download count
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    } // Exit if accessed directly
    
    /** @var DLM_Download $dlm_download */
    ?>
    <a class="download-link filetype-icon <?php echo 'filetype-' . $dlm_download->get_version()->get_filetype(); ?>"
       title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
    	   printf( __( 'Version %s', 'download-monitor' ), $dlm_download->get_version()->get_version_number() );
       } ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
    	<?php $dlm_download->the_title(); ?>
    	(<?php printf( _n( '1 download', '%d downloads', $dlm_download->get_download_count(), 'download-monitor' ), $dlm_download->get_download_count() ) ?>)
    </a>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Content Template to display mime-type icons?’ is closed to new replies.