How to do a loop inside a loop?

What if you save each query in a variable ? <ul> <?php $query1 = query_posts( array( ‘posts_per_page’ => -1, ‘post_type’ => array(‘specialties’) )); if($query1->have_posts()): while($query1->have_posts()): $query1->the_post(); ?> <li> <!– title from post type specialties –> <p><?php the_title(); ?></p> <ul> <?php $query2 = query_posts( array( ‘posts_per_page’ => -1, ‘post_type’ => array(‘team’) )); if($query2->have_posts()): while($query2->have_posts()): $query2->the_post(); ?> … Read more

Populate metabox dropdown with post title from another Custom Post Type (issues with wp_reset / global $post)

Okay, I’ve got it sorted. I found a post on here with something similar; WordPress wasn’t resetting back into the main loop. So my code is now: /* Show roles metabox */ function show_roles_metabox() { global $post; $tempPost = $post; wp_nonce_field(basename(__FILE__), ‘role_nonce’); $pro_areas = array( ‘One’, ‘Two’, ‘Three’ ); $args = array( ‘post_type’ => ‘proarea’, … Read more