wordpress - Get featured images from custom taxonomy terms -
oke, first of downloaded this plugin. enables me give custom taxonomy terms image. works great. way theme setup , way plugin wants work, isn't me.
i want images show in place should. that's why used terms (categories). because can use code:
<?php //list terms in given taxonomy $taxonomy = 'our_team'; $tax_terms = get_terms($taxonomy); ?> <ul> <?php foreach ($tax_terms $tax_term) { echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "view posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>'; } ?> </ul>
that shows names of team members when activated them (checked box) in post, , not in other places.
now able use similar code featured images. plugin uses code thumbnails.
print apply_filters( 'taxonomy-images-list-the-terms', '', array( 'before' => '<div class="my-custom-class-name">', 'after' => '</div>', 'before_image' => '<span>', 'after_image' => '</span>', 'image_size' => 'detail', 'post_id' => 15, 'taxonomy' => 'our_team', ) );
does know how "merge" these 2 codes , generate image if checked box in custom post type. or knows way this?
** update ** ok, getting somewhere. code displayed want it. of rohit kishore! thanks! here working code:
<div class="teamleden over-ons-ul"> <?php $terms = get_the_terms( $post->id , 'our_team' ); print apply_filters( 'taxonomy-images-list-the-terms', '', array( 'before' => '<div class="our-team">', 'after' => '</div>', 'before_image' => '<span>', 'after_image' => '</span>', 'image_size' => 'detail', 'taxonomy' => 'our_team', ) ); foreach ( $terms $term ) { $term_link = get_term_link( $term, 'our_team' ); if( is_wp_error( $term_link ) ) continue; } ?> </div>
the print
code had before foreach part...
Comments
Post a Comment