Add Play Icon on thumbnail overlay for video post types

i was thinking if there was anyway to add a okay icon overlay for video post types, i already came up with a code that allows me set up a default thumbnail if post has no thumb, sample code below.

div class="img-responsive" ?php if ( has_post_thumbnail() ) : ?
    a href="?php the_permalink(); ?"?php the_post_thumbnail('big-grid-one-image'); ?/a
?php else : ?
    img src=" ?php echo get_template_directory_uri (); ?/img/no-thumb/acardio-548px-450px.png" /


?php endif; ?/div

Topic post-thumbnails videos Wordpress

Category Web


Not sure where you are running your code but the below will get the post type of video if it is set I think that Wordpress returns false if there is no post type.

// This will get the post id and then test for the format type
global $post;    
    $post_id = $post->ID;
    $post_format = get_post_format($post_id);

// If your post type is a video add the code inside
    if($post_format == 'video'){
      //your code
    }

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.