0
即時通訊使用分類圖像插件,它允許我分配圖像的類別...即時通訊不太確定如何在前端顯示它。WordPress的 - 從一個類別獲取圖像
我的代碼顯示的類別如下:
$cat = get_query_var('cat');
$args = array(
'orderby' => 'id',
'child_of' => $cat,
'hide_empty' => 0
);
$categories = get_categories($args);
foreach($categories as $category) {
echo '<a href="' . get_category_link($category->term_id) . '" class="cat-c-top-bg">' . "\n";
echo ' <h4>' . $category->name . '</h4>' . "\n";
echo ' <div class="icon-view">' . "\n";
echo ' </div>' . "\n";
echo ' <div>' . "\n";
echo ' <img src="" width="164" height="164"></img>' . "\n";
echo ' </div>' . "\n";
echo ' <div class="cat-bot-ext_bg">' . "\n";
echo ' </div>' . "\n";
echo '</a>' . "\n";
}
其中一期工程完美...雖然,磨片我輸入的圖像插件提供的代碼,它顯示的圖像多次有類別,這是代碼即時放在裏面的foreach聲明
$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>';
}
任何幫助,這將是偉大的。
乾杯,