Getting custom image
-
How do I grab a custom image?
I knnow this is the part of the code to edit, but don’t know what to modify:
//Function for getting the image
function sharify_catch_that_image()
{
if ( has_post_thumbnail() ){
$sharify_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘full’ );
$sharify_thumb_url = $sharify_thumb[‘0’];
return $sharify_thumb_url;} else {
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];return $first_img;
}
}What does the code have to look like so I can grab a custom Image?
Great Plugin, tks for your help.
Greetings, Uli
The topic ‘Getting custom image’ is closed to new replies.