Created
January 11, 2012 22:40
-
-
Save billerickson/1597218 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is on the taxonomy archive page, like taxonomy-colors.php | |
// First get the info about the current term | |
$term = get_term_by( 'slug', get_query_var( 'colors' ), 'colors' ); | |
// Then see if there's any children of this tax term | |
$children = get_terms( 'colors', array( 'child_of' => $term->term_id ) ); | |
// If there are children, loop through each and do your own query | |
if( $children ) { | |
foreach( $children as $child ) { | |
$loop = new WP_Query( array( 'colors' => $child->slug ) ); | |
... | |
} | |
// If there aren't children, do the standard loop that shows all the posts in the current tax term | |
} else { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment