Only display post which has a photo
-
I have a problem, please help me.
I have a function in my function.php, it sets the first image from the post and display it, like this:
function get_imageurl_from_text($text) { preg_match('/<img.+?src=\"(.+?)\b\"/is', stripslashes($text), $match); if(strlen($match[1])) { return $match[1]; } else { return get_template_directory_uri() . "/images/no_image.jpg"; } }
I used it to display post at my homepage. And now, I only want to display the post which has photo (one or more photos) at my headline. The post has no image don’t display.
Please help me for my problem. Thank you very much.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Only display post which has a photo’ is closed to new replies.