Hi,
Usually I can see a featured image in my calendar for each event, however, sometimes users do not upload featured images. In such a scenario, I would like to show the event’s author’s image as a featured image. I’m currently using the Divi theme (Version: 2.3.1.).
I found a file by the name (epanel/custom_functions.php) which has the following code:
/*this function allows users to use the first image in their post as their thumbnail*/
if ( ! function_exists( ‘et_first_image’ ) ){
function et_first_image() {
global $post;
$img = ”;
$output = preg_match_all(‘/<img.+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches);
if ( isset($matches[1][0]) ) $img = $matches[1][0];
return trim($img);
}
}
Is there a way to mention IF no first image, then show author’s image?
Thanks~