Support » Plugin: Attachments » Custom file thumbnail by extension

  • Resolved atart



    I want to ask how i can make custom different thumbnails for each file extension? I have maybe 5 other file types, and i want for each one type create another thumbnail. Now for example *.pdf and *.odt have same icon and I want to create another icons for both types.

    I would be grateful if you could help me 😉

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jonathan Christopher


    As it stands Attachments uses the icons provided by WordPress core, and I’m not sure how to edit those, but if/when you do Attachments should pick right up on them and use them.

    I used php to solve my problem, it’s not good solution but it works.

    <?php $attachments = new Attachments( 'attachments' ); /* pass the instance name */ ?>
    			<?php if( $attachments->exist() ) : ?>
    			<?php while( $attachments->get() ) : ?>
    					<a href="<?php echo $attachments->url(); ?>" title="<?php echo $attachments->field( 'title' ); ?>">
    					$typ = $attachments->subtype();
    					if($typ == 'pdf'){
    						echo '<img src="'; bloginfo( 'template_url' ); echo'/content/products/pdf.png"  alt="" /><br />';
    					else if($typ == '3ds'){
    						echo '<img src="'; bloginfo( 'template_url' ); echo'/content/products/3ds.png"  alt="" /><br />';
    					else if($typ == 'dwg'){
    						echo '<img src="'; bloginfo( 'template_url' ); echo'/content/products/dwg.png"  alt="" /><br />';
    					<a href="<?php echo $attachments->url(); ?>" title="<?php echo $attachments->field( 'title' ); ?>"><?php echo $attachments->field( 'title' ); ?><br /><?php echo $attachments->subtype(); ?></a>
    				<?php endwhile; ?>
    				<?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom file thumbnail by extension’ is closed to new replies.