custom post type query


I use this query to call posts from a custom-type post I setup apart

$args = array( 'posts_per_page' => 5, 'order'=> 'DES', 'post_type' => 'custom-post' );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<div class="thumbnail">
<?php echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); ?>
<?php the_title( sprintf( '<h2><a href="%s">', esc_url( get_permalink() ) ),'</a></h2>' ); ?>
<?php  echo '<p>' . get_the_excerpt() . '</p>' ?>
<?php endforeach;

2 questions:
1) is that correct or can I improve it better somehow?
2) is it possible to call posts that are placed BOTH in 2 different taxonomy generated from that custom post type ("flowers" and "colors" for instance) and then call post that are in the "flowers" category but NOT in the "colors" one?
Thank you
PaoloPgn 4 months 0 Answers 10 views 0

Leave an answer