Show taxonomy page alphabetically by meta rather than default post date.
-
I have my taxonomy-regions.php to show posts depending on the region taxonomy selected. And it works except I want the posts to display alphabetically.
The code below works to sort the posts, but ends up showing all posts, not just the region I select.
$wpse20766args = array( 'orderby' => 'meta_value', 'order' => 'ASC', 'post_type' => 'agent', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'lname' ) ) ); $wpse20766q = new WP_Query( $wpse20766args ); // then the loop... if( $wpse20766q->have_posts() ): while( $wpse20766q->have_posts() ) : $wpse20766q->the_post(); // do stuff... endwhile; endif;
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Show taxonomy page alphabetically by meta rather than default post date.’ is closed to new replies.