您可以使用get_post_type() 函数并将当前的post id传递给它。
global $post;
if(get_post_type($post->ID) == \'videos\')
{
// do this
}
Update<?php
global $post;
if(get_post_type($post->ID) == \'videos\')
{
?>
<video class="video" width="<?php echo get_field(\'width\'); ?>" height="<?php echo get_field(\'height\'); ?>" controls preload>
<source src="<?php echo get_field(\'mp4\'); ?>" media="only screen and (min-device-width: 960px)"></source>
<source src="<?php echo get_field(\'iphone\'); ?>" media="only screen and (max-device-width: 960px)"></source>
<source src="<?php echo get_field(\'ogv\'); ?>"></source>
</video>
<h2><?php the_title(); ?></h2>
<?php echo get_field(\'content\'); ?>
<?php
}
?>