I'm trying to get posts from a custom posts using WP_Query.
<ul>
<?php $query1 = query_posts( array( 'posts_per_page' => -1, 'post_type' => array('specialties') ));
if(have_posts()): while(have_posts()): the_post();
?>
<li>
<!-- title from post type specialties -->
<p><?php the_title(); ?></p>
</li>
<?php
endwhile; endif; wp_reset_query();
?>
</ul>
It's working just fine. Now I need to get posts from another custom post and show inside the already created loop. Now the code looks like this:
<ul>
<?php $query1 = query_posts( array( 'posts_per_page' => -1, 'post_type' => array('specialties') ));
if(have_posts()): while(have_posts()): the_post();
?>
<li>
<!-- title from post type specialties -->
<p><?php the_title(); ?></p>
<ul>
<?php query_posts( array( 'posts_per_page' => -1, 'post_type' => array('team') ));
if(have_posts()): while(have_posts()): the_post();
?>
<!-- title from post type team -->
<li><a href="" class=""><?php the_title() ?></a></li>
<?php
endwhile; endif;
?>
</ul>
</li>
<?php
endwhile; endif; wp_reset_query();
?>
</ul>
As you can see, I'm trying to create a loop (inside another loop) to show posts from another custom post, but its not working. I also tried to add wp_reset_query() after the new endif; but it didn't work neither.
What am I doing wrong? I can't figure out what the problem is. Some help would be appreciated.