Hallo, ich möchte gerne, dass wenn ich auf ein Thumnail vom Video klicke, das sich noch ein Tab im Hintergrund mit zB google.de öffnet. Das Video sollte dann im Vordergrund geöffnet werden. Ich habe dazu die dazugehörigen Codes herausgesucht, ich hoffe das sind die richtigen. Könnte mir jemand einen Tipp geben, wie ich das am besten machen kann.
cat-featured.php
Code:
// Get items
$items = '';
$i = 0;
while ($query->have_posts()) : $query->the_post();
$thumb_html = dp_thumb_html('custom-small', '', '', false);
functions.php
Code:
/**
* Get Video Thumbnail URL
*
* Param string $size Optional. Image size. Defaults to 'custom-medium';.
*/
function dp_thumb_url($size = 'custom-medium', $default = '', $post_id = null, $echo = false){
global $post;
if(!$post_id)
$post_id = $post->ID;
if(!$size)
$size == 'custom-medium';
/* Check if this video has a feature image */
if(has_post_thumbnail() && $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size))
$thumb_url = $thumb[0];
/* If no feature image, try to get thumbnail by "Video Thumbnails" plugin */
if(empty($thumb_url) && function_exists('get_video_thumbnail')) {
$video_thumbnail = get_video_thumbnail($post_id);
if(!is_wp_error($video_thumbnail))
$thumb_url = $video_thumbnail;
}
/* If this is a video by jplayer, try to get thumbnail from video_posts */
if(empty($thumb_url) && $poster = get_post_meta($post_id, 'dp_video_poster', true))
$thumb_url = $poster;
/* If still no image or is wp error, define default image */
if(empty($thumb_url) || is_wp_error($thumb_url)) {
if($default === false || $default === 0)
return false;
$thumb_url = !empty($default) ? $default : get_template_directory_uri().'/images/nothumb.png';
}
if($echo)
echo $thumb_url;
else
return $thumb_url;
}
/**
* Display Video Thumbnail HTML
*
* Param int $size Optional. Image size. Defaults to 'custom-medium';.
*/
function dp_thumb_html($size = 'custom-medium', $default = '', $post_id = null, $echo = true) {
global $post;
if(!$post_id)
$post_id = $post->ID;
if(!$size)
$size == 'custom-medium';
// Get thumb url
$thumb_url = dp_thumb_url($size, $default, $post_id, false);
$html = '
<div class="thumb">
<a class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
<span class="clip">
<img src="'.$thumb_url.'" alt="'.esc_attr(get_the_title($post_id)).'" /><span class="vertical-align"></span>
</span>
<span class="overlay"></span>
</a>
</div>';
if($echo)
echo $html;
else
return $html;
}
functions.php
Code:
// Get image
if (is_singular()) {
global $post;
// Get image by feature image
$image = dp_thumb_url('large', false, $post->ID);
home-featured-full-width.php
Code:
<div class="screen">
<?php
if($i == 1 && !$autoscroll && is_video($post->ID) && $first_post_media == 'video') {
echo '<div class="video fluid-width-video-wrapper" data-ratio="16:9">';
dp_video($post->ID, $autoplay);
echo '</div>';
}
?>
<?php dp_thumb_html('custom-full'); ?>
</div>
home-featured.php
Code:
<?php
dp_thumb_html('custom-large');
?>
home-featured.php
Code:
<div class="carousel">
<div class="carousel-clip">
<ul class="carousel-list">
<?php $items = ''; $i = 0; while ($query->have_posts()) : $query->the_post(); global $post; ?>
<li data-id="<?php the_ID(); ?>" class="<?php echo is_video() ? 'item-video' : 'item-post'; ?>">
<div class="inner">
<?php
$thumb_size = 'custom-small';
dp_thumb_html($thumb_size);
?>
<div class="data">
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permalink to %s', 'dp'), get_the_title()); ?>"><?php the_title(); ?></a></h2>
<p class="meta">
<span class="time"><?php printf(__('%s ago', 'dp'), relative_time(get_post_time('U', true))); ?></span>
</p>
</div>
</div>
</li>
<?php $i++; endwhile; ?>
item-video.php
Code:
<div id="post-<?php the_ID(); ?>" <?php $item_format = is_video() ? 'video' : 'post'; post_class('item cf item-'.$item_format); ?>>
<?php
// Set image size based on section view, only for section box
global $section_view;
$thumb_size = 'custom-medium';
if(!empty($section_view)) {
if($section_view == 'list-large')
$thumb_size = 'custom-large';
elseif($section_view == 'grid-mini')
$thumb_size = 'custom-small';
}
dp_thumb_html($thumb_size);
?>
single.php
Code:
<?php
// Thumbnail
global $post;
$post_type = get_post_type($post_type);
$post_format = get_post_format($post->ID);
if(!$post_format && $post_type == 'post' && get_option('dp_single_thumb')) {
$thumb_url = dp_thumb_url('custom-large', '', $post->ID, false);
if(!empty($thumb_url)) {
echo '<div id="thumb" class="rich-content"><img src="'.$thumb_url.'" alt="'.esc_attr(get_the_title($post->ID)).'" /><span class="vertical-align"></div>';
}
}
?>
widget-posts.php
Code:
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
<ul class="<?php echo 'post-'.$style; ?>">
<?php while ($r->have_posts()) : $r->the_post(); $item_format = is_video() ? 'video' : 'post'; ?>
<li class="item cf <?php echo 'item-'.$item_format; ?>">
<?php
$image_size = ($style == 'list-full') ? 'custom-medium' : 'custom-small';
dp_thumb_html($image_size);
?>
widget-related-posts.php
Code:
<ul class="<?php echo 'post-'.$style; ?>">
<?php while ($r->have_posts()) : $r->the_post(); $item_format = is_video() ? 'video' : 'post'; ?>
<li class="item cf <?php echo 'item-'.$item_format; ?>">
<?php
$image_size = ($style == 'list-full') ? 'custom-medium' : 'custom-small';
dp_thumb_html($image_size);
?>
Thank you