I need display the custom taxonomy thumnbail and name on category page. I have this code :
<h1><?php single_cat_title(); ?></h1>
<?php
$taxonomy = 'kategorie_goralskie';
$terms = get_terms($taxonomy, array('parent' => 0, 'orderby' =>
'meta_value', 'order' => 'DESC') ); // Get all top level terms of a
taxonomy
if ( $terms && !is_wp_error( $terms ) ) :
?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="col-md-3">
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
</div>
<?php endwhile; ?>
<?php endif; ?>
It shows only name of child (its ok) I must show thumnail too. How i can do it ? I tried in many ways enter image description here
In front-page.php everything is ok, i see taxonomy parent - just look : enter image description here
You need to call the_post_thumbnail
function somewhere in your loop to display thumbnail. you can pass the size of the thumbnail you whant in function parameter.
See the detail of this function here : https://developer.wordpress.org/reference/functions/the_post_thumbnail/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.