Viewing 1 replies (of 1 total)
  • Plugin Author webbistro

    (@webbistro)

    Something like this:

    <?php 
    
    $args = array (
    	'post_type' => 'attachment',
    	'post_status' => 'any',
    	'posts_per_page' => -1,
    	'tax_query' => array(
    		'relation' => 'AND',
    		array(
    			'taxonomy' => 'YOUR_TAXONOMY_NAME',
    			'field' => 'slug',
    			'terms' => 'YOUR_TAXONOMY_TERM_NAME'
    		),
    		array(
    			'taxonomy' => 'category',
    			'field' => 'slug',
    			'terms' => 'YOUR_CATEGORY_NAME'
    		)
    	)
    );
    $the_query = new WP_Query( $args );
    
    if ( $the_query->have_posts() ) :
    
    	while ( $the_query->have_posts() ) : $the_query->the_post(); 
    
                echo wp_get_attachment_image( get_the_ID(), "thumbnail");
    
          endwhile; 
    
    endif;
    
    wp_reset_postdata(); 
    
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘API’ is closed to new replies.