Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function primeira_imagem() {
- global $post, $posts;
- $first_img = '';
- ob_start();
- ob_end_clean();
- $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
- if($output >= 1) {
- $first_img = $matches[1][0];
- }
- return $first_img;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement