[英]Custom taxonomy thumnbails for custom post type on category page
我需要在类别页面上显示自定义分类法缩略图和名称。 我有这个代码:
<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; ?>
它只显示孩子的名字(可以),我也必须显示缩略图。 我该怎么办? 我尝试了多种方式在此处输入图片描述
在front-page.php中,一切正常,我看到了分类父类-只需看一下: 在此处输入图片描述
您需要在循环中的某处调用the_post_thumbnail
函数以显示缩略图。 您可以在功能参数中传递您想要的缩略图的大小。
请在此处查看此功能的详细信息: https : //developer.wordpress.org/reference/functions/the_post_thumbnail/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.