Hi,
1) Please activate your child theme.
2) Copy and paste this into your child theme functions.php
file
if (!function_exists('swift_pinterest_get_first_image_in_post')) {
function swift_pinterest_get_first_image_in_post() {
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)) {
$first_img = ""; // You can also set a default image path
}
return $first_img;
}
}
3) Within you child theme create a new file, called single.php
.
4) Copy and paste the code into single.php
. Full code here, please copy this exactly. http://pastie.org/private/karqmo0rttxh6zrfd3f8jg#233.
That will do it.
Thanks,
David.