Advertisement
Guest User

Function to check if a event have a featured image.

a guest
Apr 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. function check_featured_image(){
  2.          global $post;
  3.          $featured_image = tribe_event_featured_image($post->ID);
  4.          if($featured_image){
  5.              return $featured_image;
  6.          }else{
  7.             set_post_thumbnail( $post->ID, '0000' ); // here the ID of the image that you want to use as default.
  8.             $featured_image = get_the_post_thumbnail($post->ID);
  9.             return $featured_image;        
  10.          }
  11.          
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement