我已经设置为自定义后的类型和音乐,商业,促销这篇文章类型中设置为类视频:显示自定义职位类型的自定义字段信息
我有一个显示自定义的元函数在wordpress后端的视频文章类型页面上打开框。用户可以输入YouTube视频的ID或VIMO视频的ID - wordpress然后在自定义帖子类型页面上显示ID的视频。当用户向视频自定义帖子类型添加新帖子并将其分配给我指定的任何类别时,我希望wordpress能够显示不同的视频。我目前的代码没有做我想做的事情,因为它在每个帖子上都显示相同的视频,即使某些ID上没有指定ID也是如此。例如,在音乐文章页面上,我已经为其分配了类别音乐,并在前端显示了一个vimeo视频ID,但之后显示的是同一个视频用于促销和广告,我不希望发生这种情况。我已经运行这个循环是(单videos.php):
<?php
$args = array('post_type' => 'videos', 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'ASC');
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post();
//$args = array('post_type' => 'videos', 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'ASC');
$ytubeID = get_post_meta($post->ID, '_youtubeID', true);
$vimID = get_post_meta($post->ID, '_vimeoID', true);
if ($ytubeID || $vimID){
if ($ytubeID){
echo '<iframe title="YouTube video player" class="youtube-player" type="text/html" src="http://www.youtube.com/embed/'.$ytubeID.'" allowfullscreen="true" frameborder="0" width="640" height="390">';
echo '</iframe>';
} elseif ($vimID){
echo '<br />';
echo '<iframe src="http://player.vimeo.com/video/'.$vimID.'" width="640" height="390" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
}//end if yutbeID or vimIDthe_excerpt(); //excerpt added for information
}
endwhile;
wp_reset_query();
?>
[是跨张贴在多个栈Exchange站点问题如果问题是针对每个网站的主题,是否允许?](http://meta.stackexchange.com/q/64068/185667) – brasofilo
Im sorry @brasofilo我真的不知道。 –
那么,答案是否定的,不要在2个网站中多发帖子。 – brasofilo