I'm transitioning all my query_posts queries to get_posts after a lot of research about how bad it is for performance. My solution is get_posts but working with it is confusing me. Here is what I have:
$posts = get_posts('showposts=-1&offest=10&post_type=any');
foreach ($posts as $post) :
?>
<div class="box">
<a href="<?php the_permalink() ?>" rel="bookmark">
<h2><?php the_title(); ?></h2>
<?php if (has_post_thumbnail()) {
the_post_thumbnail('thumbnail');
}?>
<?php the_content();?></a>
</div><?php endforeach; ?>
It works but some of the params don't, such as offset and "any" post type is to vague.
$posts = get_posts('showposts=-1&offest=10&post_type=any');
The codex tells us that we can also use an array:
$query = new WP_Query( array( 'post_type' => array( 'post', 'page', 'movie', 'book' ) ) );
But this is a common problem I don't know how to handle. How do I get dynamic parameters into the array, or where can I find the rules for parameters in string format like my code?
offest
... maybe that's why it's not working...