[英]To display the category image in the page
我已經使用了“分類圖像”插件來存儲每個類別的圖像。 現在我要顯示類別圖像。 但是我找不到任何設置來顯示這些圖像。 有沒有更好的插件來顯示帶有類別名稱的類別圖像。
要顯示類別圖像,只需使用以下命令:
$terms = apply_filters( 'taxonomy-images-get-terms', '' );
if ( ! empty( $terms ) ) {
print '<ul>';
foreach( (array) $terms as $term ) {
print '<li><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' ) . '</li>';
}
print '</ul>';
}
默認顯示“類別”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.