0
有一個頁面顯示來自自定義文章類型的視頻。在視頻上傳頁面,用戶可以決定他們是否想要一個視頻縮略圖或他們自己的照片。if word in wordpress page - always one or other
我讓他們選擇一個單選按鈕。變量被分配爲作者或視頻(視頻默認)。
我想將它設置爲當自定義字段=作者和縮略圖時自定義字段=視頻顯示作者。
所有視頻回覆筆者的縮略圖......也許我缺少明顯的東西...
<?php
if (have_posts()) : while (have_posts()) : the_post();
$video_post_type = get_custom_fields('video_post_type');
endwhile;
else:
endif;
?>
<?php
<?php
$x = 1;
$loop = new WP_Query(array (
'post_type' => 'video',
'posts_per_page' => 12,
'paged' => get_query_var('paged')
));
if ($loop->have_posts()) : while ($loop->have_posts()) :
$loop->the_post();
$do_not_duplicate = $post->ID;
$video_url=get_post_custom_values('video-url');
$thumb_url=null;
$pic_choice=get_post_custom_values('video-image');
if(strpos($video_url[0], 'youtube.com')!==false){
$url_string = parse_url($video_url[0], PHP_URL_QUERY);
parse_str($url_string, $args);
$vid_id = isset($args['v']) ? $args['v'] : false;
if($vid_id){
$thumb_url='http://img.youtube.com/vi/'.$vid_id.'/hqdefault.jpg';
}
}
if(strpos($video_url[0], 'vimeo.com')!==false){
$vid_id = basename($video_url[0]);
$thumb_url = getVimeoInfo($vid_id,"thumbnail_medium");
}
if(!$thumb_url){
$thumb_url= get_bloginfo('template_directory').'/img/vid-thumb.png';
}
?>
<div class="video-thumb">
<a href="<?php custom_fields('video-url'); ?>">
<?php if ($pic_choice = "author"):?>
<?php userphoto_the_author_photo();?>
<?php else:?>
<img src="<?php echo $thumb_url; ?>" width="200" height="150"/>
<?php endif; ?>
</a>
<div style="text-align:center;" class="video-meta">
<a href="<?php custom_fields('video-url'); ?>"><strong>
<?php the_title(); ?></strong></a> <br/>
<span class="vid-date"><?php custom_fields('video-date'); ?></span> <br/>
<span class="vid-date"><?php custom_fields('video-speaker'); ?></span>
<br/>
<span class="vid-date"><?php custom_fields('video-image'); ?></span> <br/>
</div>
</div>
<?php
endwhile;
else:
endif;
?>
<div class="page-nav">
<?php wp_pagenavi(array('query' => $loop)); ?>
</div>