Sort hierarchical Custom Taxonomy
-
I have a hierarchical custom taxonomy named children and inside the taxonomy i have two children “easton” and “kiari” the code calls all posts from the taxonomy, but they are still sorted independently so i get all posts sorted by post date for easton, and then all posts sorted by post date for kiari. The question is how do i combine the taxonomy and sort by post date so i get posts sorted by date regardless of weather its from easton, or kiari.
Current sort example:
easton july 30 2011
easton july 15 2011
easton july 1 2011
kiari july 30 2011
kiari july 14 2011
kiari july 2 2011Desired Sort Example
easton july 30 2011
kiari july 29 2011
easton july 15 2011
kiari july 14 2011
kiari july 2 2011
easton july 1 2011here’s my code:
<?php // List posts by the terms for a custom taxonomy of any post type $tax = 'children'; $tax_terms = get_terms( $tax ); if ($tax_terms) { foreach ($tax_terms as $tax_term) { $args = array( "$tax" => $tax_term->slug, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1, 'orderby' => 'post_date', 'order' => 'DESC', ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) : ?>
The topic ‘Sort hierarchical Custom Taxonomy’ is closed to new replies.