• I installed a plugin “video thumbnails” to help me automatically display the thumbnail of a video when the content is a video. Reason for this is because I have a list of categories on top of my page that will show the latest post thumbnail in that category. I need to show a a thumbnail not the video of course.

    everything works just fine except when you go to the post itself or viewing the post from a list, it will show the video thumbnail, and the video content. I want it to just show the video content when you see the post.

    originally my content.php handling this looked like this.

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    		<header class="entry-header">  
     		<?php the_title( sprintf('<h2 class="entry-title"><a href="%s">', esc_url( get_permalink() ) ),'</a></h2>' ); ?>  
     		  <center><H3><?php the_time('F j, Y'); ?></H3></center>
     		  
     	</header>  
     	  
     	<div class="row">  
     		  
     		<?php if( has_post_thumbnail() ): ?>  
     		  
     			
     				<div class="thumbnail" style="width:100%;"><?php the_post_thumbnail('large'); ?></div>  
     			
     				<?php the_content(); ?>  
     			
     		  
     		<?php else: ?>  
     		  
     			
     				<?php the_content(); ?>
     			
     		  
     		<?php endif; ?>  
     	</div>  
       
     </article> 
    

    I did some switching around and came up with this

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    		<header class="entry-header">  
     		<?php the_title( sprintf('<h2 class="entry-title"><a href="%s">', esc_url( get_permalink() ) ),'</a></h2>' ); ?>  
     		  <center><H3><?php the_time('F j, Y'); ?></H3></center>
     		  
     	</header>  
     	  
     	<div class="row">  
     		  
     		<?php if( has_post_thumbnail() ): ?>  
     		  
     			
     				
     			
     				<?php the_content(); ?>  
     			
     		  
     		<?php else: ?>  
     		  
     			
     				<div class="thumbnail" style="width:100%;"><?php the_post_thumbnail('large'); ?></div>  
     			
     		  
     		<?php endif; ?>  
     	</div>  
       
     </article> 
    

    Great! now the video content shows instead of both the thumbnail and the video. even the top listed categories shows just the post thumbnail like I wanted it.

    only one issue. all the thumbnails of my non-video posts do not show.

    how can I fix this so that if I have a video. the post will show just the video content
    while still showing thumbnails from non-video content posts?

    Quick note: I fully understand I can create a Content-Video.php template and when I want a video I can set it to that template and it will solve all my issues. However, I do not want to have to manually set it to that template. I would like content.php to handle all of this for me.

  • The topic ‘video thumbnail issue’ is closed to new replies.