/ Published in: PHP
catches the first image of a post so you can display it however you like within the loop
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//grabs the first image from a post function catch_that_image() { global $post, $posts; $first_img = ''; $first_img = $matches [1] [0]; { //Defines a default image $first_img = "/images/default.jpg"; } return $first_img; }