-
-
Save wpsmith/4475503 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
add_action( 'genesis_loop', 'cd_custom_taxonomy_archives' ); | |
/** | |
* Output the taxonomy name and an associated taxonomy image | |
*/ | |
function cd_custom_taxonomy_archives() { | |
//print the page title | |
the_title('<h1 class="entry-title">', '</h1>'); | |
// Code sample modified from example on http://wordpress.mfields.org/plugins/taxonomy-images/ | |
// This filter pulls similar results to get_terms(), except it also includes an image reference | |
// Only return parent terms | |
$terms = apply_filters( 'taxonomy-images-get-terms', '', array( 'taxonomy' =>'your-tax-name', 'term_args' => array( 'parent' => 0 ) ) ); | |
foreach( (array) $terms as $term ) { | |
// div wrapper for portfolio layout | |
echo '<div class="post-type-archive-portfolio portfolio">'; | |
echo '<h2 class="entry-title"><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">'. $term->name. '</a></h2>'; | |
echo '<div class="portfolio-featured-image"><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'portfolio' ) . '</a></div>'; | |
echo '</div>'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!