の正しいterm_idを取得する方法。各カテゴリーおよびリスト画面上のカテゴリーの<strong>W4ポスト一覧</strong>に画像を挿入することができるため、私は2つのプラグイン<strong>WPCustomカテゴリイメージ</strong>を使用しています各記事
この瞬間、常にカテゴリの最後のイメージを与えてください。私は各IDに対応する各カテゴリーのイメージをふりまとめています。
プラグインには、対応するカテゴリIDを示す1つのshortcode [term_id]がありますが、別のショートコードから1つのshortcodeを使用することはできません。
例 - [wp_custom_image_category onlysrc = "false" のサイズ= "フル" 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]';
}