• Resolved jstanj

    (@jstanj)


    Hi ahoereth,

    The plugin looks great and seems to be exactly what I’m looking for.

    Unfortunately, I can’t get it work unless I use the shortcode. I think it’s something to do with the theme I’m using (a pretty heavily modified version of Reaction), which uses PrettyPhoto as well.

    Once I get the shortcode in, it displays the video, but the video plays about 20px below the featured image–leaving a nasty looking bar of the featured image on top. Any suggestions? I’ve tried cropping the featured image to match the video resolution exactly, with no luck.

    You can view it in action here. Any help is much appreciated. Thanks!

    https://www.ads-software.com/extend/plugins/featured-video-plus/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Alex

    (@ahoereth)

    The featured image is not replaced by the featured video.

    You modified the original theme? Than it should be no problem for you to integrate the featured video plus plugin as well:
    All you need to do is find the place where the featured images is added to the posts/pages. Then put the code which echos the image in a conditional which either prints the video or the image when no video is available.

    Here an example for the Zoren theme: https://www.diffchecker.com/avknjdqn
    On the left side is the original code. On the right I added

    if(function_exists('has_post_video') && has_post_video()):
        the_post_video();
    else: [...] endif;

    […] contains all the normal featured image stuff.

    Please report back if this works or if I can help further!
    Alex

    Thread Starter jstanj

    (@jstanj)

    Thanks. I’m not super great with php, but does this look correct?

    ORIGINAL

    <?php if(get_option_tree('show_featured_image') == 'Yes') : ?>
      <?php if (has_post_thumbnail( $post->ID )) {
    
    // Grab the URL for the thumbnail (featured image)
    	$thumb = get_post_thumbnail_id();
    	$image_full = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
    	$imgheight = ot_get_option('default_image_height', $theme_options, false, true, 0 );
    	$image = vt_resize( $thumb, '', 700, $imgheight, true );		
    
    	// Check for a lightbox link, if it exists, use that as the value.
    	// If it doesn't, use the featured image URL from above.
    	if(get_custom_field('lightbox_link')) {
    $lightbox_link = get_custom_field('lightbox_link');
    } else {
    	$lightbox_link = $image_full[0];
    } ?>
    
    	<a href="<?php echo $lightbox_link; ?>" data-rel="prettyPhoto[<?php echo $post_slug; ?>]">
    	<img class="aligncenter" src="<?php echo $image[url]; ?>" width="<?php echo $image[width]; ?>" height="<?php echo $image[height]; ?>" alt="<?php the_title(); ?>" />
    					</a>
    
    				<br class="clearfix" />
    				<?php } else {} ?>
    				<?php endif; ?>

    EDITED

    <?php if(get_option_tree('show_featured_image') == 'Yes') : ?>
    <?php if(function_exists('has_post_video') && has_post_video()):
        	the_post_video();
    	else:
    	if (has_post_thumbnail( $post->ID )) {
    
    	// Grab the URL for the thumbnail (featured image)
    	$thumb = get_post_thumbnail_id();
    	$image_full = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
    	$imgheight = ot_get_option('default_image_height', $theme_options, false, true, 0 );
    	$image = vt_resize( $thumb, '', 700, $imgheight, true );		
    
    	// Check for a lightbox link, if it exists, use that as the value.
    	// If it doesn't, use the featured image URL from above.
    	if(get_custom_field('lightbox_link')) {
    	$lightbox_link = get_custom_field('lightbox_link');
    							} else {
    	$lightbox_link = $image_full[0];
    							}
    
    						?>
    
    	<a href="<?php echo $lightbox_link; ?>" data-rel="prettyPhoto[<?php echo $post_slug; ?>]">
    	<img class="aligncenter" src="<?php echo $image[url]; ?>" width="<?php echo $image[width]; ?>" height="<?php echo $image[height]; ?>" alt="<?php the_title(); ?>" />
    					</a>
    
    				<br class="clearfix" />
    				<?php } else {} ?>	  
    
    			<?php endif; ?>

    Plugin Author Alex

    (@ahoereth)

    Yea for clean php you could merge

    else:
    if (has_post_thumbnail( $post->ID )) {

    to

    elseif(has_post_thumbnail( $post->ID )) :

    And then change

    <?php } else {} ?>
    <?php endif; ?>

    to just

    <?php endif; ?>

    Also check if you have as many endif’s and }’s as “if :”‘s and {‘s ??
    If the layout breaks try adding

    echo '<br class="clearfix" />;'

    behind the_post_video().

    Alex

    Thread Starter jstanj

    (@jstanj)

    That did it, thanks!

    Thanks for the tip about php as well. I assumed you close it out like everything else, just haven’t taking the time to learn what those tages are yet.

    Cheers,
    Jason

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Video Offset Featured Image’ is closed to new replies.