0

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>
0

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
    }
  • thanks my friend for your effort, but this my friend got me more confused, where do yu think i could implement this code and how. – Kazem Nocktrine Mar 16 '17 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.