Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The files are .ppt and .pdf files (not images).

Will it be possible to query these types of attachments and output it in a unordered list?

share|improve this question

1 Answer 1

I don't think it's documented in Codex but quick search in code shows that you can query by mime type. For jpeg images that would be something like:

$posts = get_posts( array(
            'post_type' => 'attachment',
            'post_status' => 'any',
            'post_mime_type' => 'image/jpeg',

             ) );

Not sure what types WP uses for files you need, don't have such in test stack to check.

share|improve this answer
    
I didnt know that..thanks man –  user3764 Jul 6 '11 at 4:13
    
do you think this can be done with multiple mime-types? PDF & PPT? OR can you just exclude a mime-type? –  daniel Crabbe Jul 27 '11 at 8:11
    
@daniel Crabbe according to quick look at code it should take array or comma-separated list of multiple mime types just fine. –  Rarst Jul 27 '11 at 8:55
    
indeed it does - thanks! –  daniel Crabbe Jul 27 '11 at 9:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.