Has anyone had any joy getting the latest download post using the get_posts WordPress function? I have tried getting a single post using this, as below, but have had no joy:
<?php $args = array( 'posts_per_page' => 1, 'category' => 2, 'post_type' => 'dlm_download');
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
"><?php the_title(); ?>
<?php endforeach; ?>
The category ID for my post category is 2, and this category has 30 posts, so I should be getting a post returned. If anyone could shed any light that would be great.