I have a Wordpress site which uses a feature image on the posts which link to a page with the post's content (images, content, etc)
I separate out the images from the content with
<?php
preg_match_all('/(<img [^>]*>)/', get_the_content(), $images);
for( $i=0; isset($images[1]) && $i < count($images[1]); $i++ ) {
echo $images[1][$i];
}
?>
I want to target the first image of each individual post (it is not the featured image) I want to put
<h1><?php the_title(); ?></h1>
overtop the first image, to make it act as a header for the post, then I can have the other images and text underneath. not sure how to accomplish this
EDIT - clarification
My index.php shows the featured image of each post in a 'thumbnail gallery' style. each picture links to content-single.php where the content and images are displayed for that post (the featured image is NOT on this page). content-single.php is where i pull out the text and the images
I want to be able to put a title overlapping the first image of the post (NOT the featured image on index.php) because I want the first image of the content to act as a header for each single post page