how to use first post image as thumbnail on wordpress
You can try this function, in your functions.php file. // automatically retrieve the first image from posts function get_first_image() { global $post, $posts; $first_img = ”; ob_start(); ob_end_clean(); $output = preg_match_all( ‘/<img .+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches ); $first_img = $matches[1][0]; if ( empty( $first_img ) ) { // defines a fallback imaage $first_img = get_template_directory_uri() . … Read more