Hello all, this should be a quick fix (hah!), I just don't have the php skills.
This is in my sidebar.php displaying all media uploaded to my wordpress installation. I want to filter it so that it only will display media if it has certain file extensions, (i.e. pdf, doc, rtf). What do I need to change/add in order for that to happen?
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => null, // any parent
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $post) { ?>
<li>
<?php
setup_postdata($post);
the_attachment_link($post->ID, true);
?>
</li>
<?php
}
}
?>