I have a CPT for "Band Members", and I want to list all of them at the top of a template, above all the posts (which will just be featured images) - a sort-of Navigation for all members. I can't think of how to do this... is there two loops? Any help would be appreciated!
<div id="main">
<?php
$args=array(
'post_type' => 'band_member',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1 // WHAT IS THIS??
);
$my_query = null;
$my_query = new WP_Query($args);
echo '<div class="post-nav">';
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
<a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a>
<?php
endwhile;
}
echo '</div><!-- end post nav -->';
wp_reset_query(); // Restore global post data stomped by the_post().
?>
<?php
// PUT ALL CPT FEATURED IMAGES HERE...
?>
</div><!-- /main -->
END OF ORIGINAL CODE.....
NEW CODE WITH HELP.....
<section id="main">
<?php
$args=array(
'post_type' => 'band_member',
'post_status' => 'publish',
'posts_per_page' => -1,
);
$my_query = null;
$my_query = new WP_Query($args);
echo '<div class="post-nav">';
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
<a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a>
<?php
endwhile;
}
echo '</div><!-- end post nav -->';
wp_reset_query(); // Restore global post data stomped by the_post().
?>
<?php
$args=array(
'post_type' => 'band_member',
'post_status' => 'publish',
'posts_per_page' => -1,
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
<a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_post_thumbnail(); ?></a>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
</section><!-- /#main -->