Retrieve posts in custom post type and specific taxonomies

Both get_posts() and wp_query() should be able to do this by passing the tax_query array into them. Example: $query = array( ‘post_type’ => ‘portfolio’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘clients’, ‘field’ => ‘slug’, ‘terms’ => array( ‘acme’ ) ) ), ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ ); $posts … Read more

Sort by name – second wp_query

Posts are not sorted alphabetically, because you don’t tell WordPress to sort them in such way. By default they will be sorted by date in descendant order (newest first). What you should do, is change your WP_Query args by adding order and orderby, so it should look like this: $args = array( ‘post_type’ => ‘os_book’, … Read more