我有一种情况,唯一的方法似乎是在循环中使用循环。Is that a good idea?
像其他人一样,我在寻找可能的最佳解决方案。
Situation:
<我需要为每种类型分配不同的标记(这些是分类法)What I\'ve got:
// Types
$car_type = get_the_terms( $post->ID, \'car-type\' );
foreach ( $car_type as $type ) {
$type_slug = $type->slug;
foreach ( $type_slug as $type_slug ) {
$marker_image = \'https://www.my-site.com/media/markers/marker_\' . $type_slug . \'.png\';
}
}