Support » Themes and Templates » query_tax for all images in posts

  • I see that there are numerable forum threads where people discuss getting all the images from a single post.

    In this case I am trying to:

    1. query for all posts that have a certain taxonomy ( in this case: projects )
    2. then show all of the attached images from ALL these posts in a slideshow

    This is what I have so far, which so far is only successful in getting the post_thumbnail:

    <!-- featured slides for the projects -->
    <ul id="featured_slides" class="rslides">
    		 $related_project_posts = array(
    		 'posts_per_page' => -1,
    		 'post_type' => 'post',
    		 'nopaging' => true,
    		 'suppress_filters' => false, // this argument is required for CPT-onomies	
    			'tax_query' => array(
    			'terms'    => get_the_ID(),
    			'field' => 'slug'
    //		print_r($related_project_posts);
    $postslist = get_posts( $related_project_posts );
    foreach ($postslist as $post) :  setup_postdata($post); ?> 
    <li><a href="<?php the_permalink();?>"><?php the_post_thumbnail( 'grid_16_landscape' ); ?></a></li>
    <?php endforeach; ?>
    </ul><!-- featured_slides grid_16 //-->
  • The topic ‘query_tax for all images in posts’ is closed to new replies.