Home › Forums › Support › Bought GP Premium › Reply To: Bought GP Premium
February 25, 2015 at 1:52 pm
#80127
Tom
Lead Developer
Lead Developer
I just took a look at the code from the MesoColumn theme and have confirmed that they take the first image in the post and set it as the featured image.
Here’s an excerpt from the code:
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
if($output): $first_img = $matches[1][0]; endif;
This part gets the first match with an <img>
tag: $matches[1][0]