Support » Plugin: MimeTypes Link Icons » Using mimetypes-link-icons outside loops

  • Hi, just found this plugin recently and it works great inside loops.
    I just want to know, is there any chance I can use it outside.
    I want to show download links, with mime icons on sidebar.
    My existing code is:

    $args = array(
    	'order'          => 'ASC',
    	'post_type'      => 'attachment',
    	'post_parent'    => $post->ID,
    	'post_mime_type' => 'application',
    	'post_status'    => null,
    	'numberposts'    => -1,
    $attachments = get_posts($args);
    if ($attachments) : ?><h3 class="widget-title"><span>Attachment files</span></h3> <div class="widget"><ul>
    <?php	foreach ($attachments as $attachment) {
    		echo '<li>', the_attachment_link($attachment->ID, 'files_attachment', true, false), '</li>';
    	} ?>
    <?php endif;?>

    This code works but it will be better if it shows icons and file sizes.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author eagerterrier


    @pauro sorry for late response. Developers don’t get notified of new posts to the forum. I have to check periodically to see if there’s anything new.

    I’ll have a look at your code and have a think. My first thought is that we could do something for you on a one off basis with jQuery…

    Hello there. First of all I also want to let you know that you did a great job. I really like this plugin.

    Unfortunately for me it’s the same than for “pauro”: I am not able to get it working with links outside the loop.

    I use it in combination with the Plugin “Attachments” and it works perfectly inside content-area. But when I put downloads i.e. into the sidebar, these documents don’t get their icon.

    Maybee you can catch up with that in one of the next versions? I would really appreciate that. 🙂

    Plugin Author eagerterrier


    @pauro / @megalop

    I think @megalop has come up with a good solution here.

    I tried thinking of a way to get the plugin to work outside the loop on an ad hoc basis, but couldn’t find a decent way of doing it.

    Perhaps the solution is this:

    1. Have a text entry field in the admin area that will ask for selectors that you want targeted – ie #mysidebardiv or .attachments

    2. These selectors are passed to the front end. Jquery will asyncronously process these to give us the nice links we require


    a). Does this make sense?

    b). Do we all think this is an acceptable solution?

    Let me know within the next couple of weeks. I’m planning a new version of the plugin before the end of June / beginning of July

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using mimetypes-link-icons outside loops’ is closed to new replies.