I currently use query_posts
to show these custom posts but I’m pretty sure that I should uses get_posts()
to write it correctly.
<?php query_posts( array( 'type-mario' => 'games', 'showposts' => 10 ) ); ?>
<p>Mario games</p>
<?php while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2><?php the_title(); ?></h2>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Thanks for your advice.
Hi Elium2009:
Using your code, I think this is what you were looking for? (note that
WP_Query()
is just the more direct version ofget_posts()
):Hope this helps?
You can use either really, but if you want to use get_posts this is how it’s done: