Is it possible to query specific WordPress Attachment files (.ppt & .pdf) and output them in a list?

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.

Leave a Comment