我想在两个标签之间加一个变量,但这会让他失望。
这是我的函数:(function.php)
/* traer thumb */
function item_thumb() {
global $post;
if (has_post_format(\'video\')) {
$key_1_value = get_post_meta( $post->ID, \'video\', true );
if (!empty( $key_1_value ) ) {
$post_video = \'<div class="item-video embed-responsive embed-responsive-16by9">\';
$post_video.= wp_oembed_get($key_1_value);
$post_video.= \'</div>\';
return $post_video;
}
} else {
if (has_post_thumbnail()) {
$item_image = \'<div class="item-image">\';
$item_image.= the_post_thumbnail( \'thumb_destacado\', array( \'class\' => \'img-responsive full-width\'));
$item_image.= \'</div>\';
return $item_image;
}
}
}
看这个:视频没问题:
<div class="item-video embed-responsive embed-responsive-16by9">
<iframe width="600" height="338" src="https://www.youtube.com/embed/rdlFMPXJ44o?feature=oembed" frameborder="0" allowfullscreen="" class="embed-responsive-item"></iframe>
</div>
但缩略图是这样显示的:
<img width="630" height="300" src="http://localhost/agroverdad.com.ar/wp-content/uploads/2016/02/Carne-Exportacion-630-630x300.jpg" class="img-responsive full-width wp-post-image" alt="Carne-Exportacion-630">
<div class="item-image"></div>