Hi All
I have a wordpress site that has lots of pages with attachments (PDF Datasheets). The pages are structured like this...
Main
-- Category 1
---- Page 1
---- Page 2
-- Category 2
---- Page 1
---- Page 2
I have a downloads page that lists ALL the available downloads on the entire website which is a long list, using the code below:
<ul>
<?php
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'application/pdf',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
'orderby' => 'title',
'order' => 'asc'
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo '<li><a href="'.wp_get_attachment_url($attachment->ID).'">';
echo $attachment->post_title;
echo '</a></li>';
}
}
?>
</ul>
I would like to be able to split the list down in to several smaller lists, for example only showing the downloads for the children of 'Category 1'
Tried adding a post_parent but can't seem to get it to work.
Any help would be appreciated.
Cheers