这是我正在处理的文件:
<?php
$class =\'\';
foreach ($consoles as $console) {
$class .= $console->slug . \' \';
}
?>
<div id="<?php the_id(); ?>" class="<?php echo $class ?>>
Content
</div>
<?php
$consoles = wp_get_object_terms( $post->ID, \'consoles\' );
$separator = ", ";
$output = \'\';
if ( ! empty( $consoles ) ) {
if ( ! is_wp_error( $consoles ) ) {
echo \'<li><span>Platforms:</span> \';
foreach( $consoles as $term ) {
$output .= esc_html( $term->name ) . $separator;
} echo trim($output, $separator);
echo \'</li>\';
}
}
?>