I've been reading the codex (
get_children function) and trying some combinations but with no luck. Does anyone knows how to retrieve the audio files of certain category (say "podcasts") in the sidebar ?
I tried this but it throws me an error related to the foreach argument :
<?php $attachments =& get_children( array( 'category_name' => 'podcasts', 'numberposts' => '8', 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'post_status' => null, 'post_parent' => null, // any parent 'output' => 'object', ) ); foreach($attachments as $attach): echo wp_get_attachment_link($attach); ?> <?php endforeach; ?>
Thanks for any help.