我使用兩個插件WPCustom範疇圖片爲了能在每個類別和W4郵冊的列表屏幕上的類別,以插入圖像。如何得到正確的term_id每篇文章
在這一刻,給我總是最後一個圖像的類別。我假裝每個類別對應於每個ID的圖像。
該插件有一個短代碼[term_id],它顯示相應的類別ID,但我不能從另一個短代碼中使用一個短代碼。
例 - [wp_custom_image_category onlysrc = 「假」 大小= 「滿」 term_id = 「[term_id」]]
任何溶液?
foreach(get_categories(['hide_empty' => false]) as $category) {
$image = do_shortcode('[wp_custom_image_category onlysrc="false" size="full" term_id="'.$category->term_id.'" ]');
echo $image.'<br/>';
// $id = 4;
$options['template'] =
'[terms]
<div class="col-sm-3 news-cat-links" id="[term_id]">
<a href="[term_link]">[term_name]</a><img src="'.$image.'" /></a>
</div>[/terms]';
}