WordPress.org

Support

Support » Plugins and Hacks » Video Thumbnails » [Resolved] [Plugin: Video Thumbnails] Conditional thumbnail on index.php and single.php

[Resolved] [Plugin: Video Thumbnails] Conditional thumbnail on index.php and single.php

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

    @sutherlandboswell

    Yep, just use

    <?php if( ( $video_thumbnail = get_video_thumbnail() ) != null && !is_single() ) { echo "<img src='" . $video_thumbnail . "' />"; } ?>

    Hmm. Didn’t seem to do what I want. The video thumbnail still displays fine on my homepage, but still displays on the single post page. If it’s a thumbnail specifically from the video, then I don’t want it to show up at all on the single post.

    This is what I have in my single.php file:

    <div id="single-thumb">
    
    <?php if( ( $video_thumbnail = get_video_thumbnail() ) != null && !is_single() ) {
    	echo "<img src='" . $video_thumbnail . "' />"; } ?>
    
    	<?php if ( has_post_thumbnail() ) {
    				the_post_thumbnail('post-thumb'); ?>
    			<?php } ?>
    </div>
    Plugin Author Sutherland Boswell

    @sutherlandboswell

    So the plugin settings have the video thumbnail set as a featured image? If that’s the case you can try this in single.php:

    <?php if( get_video_thumbnail() == null &&  has_post_thumbnail() ) { ?>
    <div id="single-thumb">
    	<?php the_post_thumbnail('post-thumb'); ?>
    </div>
    <?php } ?>

    That did the trick. Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Video Thumbnails] Conditional thumbnail on index.php and single.php’ is closed to new replies.
Skip to toolbar