I'm currently using get_posts() for a little part of a theme I'm working on. However, I've run into one little hiccup.
If I want to show all posts for a category, I set the 'numberposts' argument to '-1'. However the issue is that when I do this, the offset no longer works.
I do see that I'm telling the function to return all posts, but then I'm expecting it to not actually return all posts. So, I do see the dilemma in the logic.
So using get_posts, is there a way to show all posts except for posts offset at the beginning? I realize there are a few hacky ways you could this, but I'm just wondering if I'm doing something incorrectly here that is obvious? I'd like to work within the constraints of the get_posts function if possible.
I did start to rig up something sort of hacky. This works, but wondering if there was another way to go about this.
// Get posts
$posts = get_posts( $args );
// Adjust offset if neccesary
if( $args['numberposts'] == -1 && $args['offset'] > 0 ) {
$i = 0;
while ( $i < $args['offset'] ) {
unset( $posts[$i] );
$i++;
}
}
// ... now do my foreach() and setup_postdata
