This file contains hidden or 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 | |
/** | |
* | |
* Loop through some custom post types and group them by taxonomy term, | |
* outputting the taxonomy term names before the set of posts | |
* | |
*/ | |
// get all of the custom taxonomy terms | |
$taxonomy = 'my_custom_taxonomy'; |
This file contains hidden or 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
/** | |
* Get posts and group by taxonomy terms. | |
* @param string $posts Post type to get. | |
* @param string $terms Taxonomy to group by. | |
* @param integer $count How many post to show per taxonomy term. | |
*/ | |
function list_posts_by_term( $posts, $terms, $count = -1 ) { | |
$tax_terms = get_terms( $terms, 'orderby=name'); | |
$args = array( |