[英]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.