How to Show Thumbnail on Custom Post Type Archive?
Closed this issue · 1 comments
slapz commented
@daggerhart what if the template where I'm trying to show the taxonomy term image is the archive of a Custom Post Type? I'm having issues with this. Here's my code:
<?php
$args = array(
'type' => 'lyric',
'child_of' => 0,
'parent' => 0,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0,
'hierarchical' => 1,
'taxonomy' => 'project'
);
foreach ( get_categories( $args ) as $taxonomy_cat ) {
echo '<li>' .
wp_get_attachment_image( $taxonomy_cat->term_image, 'thumbnail' ) .
$taxonomy_cat->name .
'</li>';
}
?>
Seems as though everything works fine except for:
wp_get_attachment_image( $taxonomy_cat->term_image, 'thumbnail' )
If you could help me out with this as soon as possible, that would be great. Thanks!
daggerhart commented
Thanks for the report. This should be fixed.
The problem was that get_terms()
(and thus, get_categories()
) did not fire the get_term
hook I was using to add term_image data. To fix it, I implemented the get_terms
hook.