Not working on my theme?
-
Not working with DeTube.
Here is what DeTube uses as featured image?
Can I change something in plugin or in this code to make it work, I would rather change in plugin if possible…/** * 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; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Not working on my theme?’ is closed to new replies.