[wp-hackers] Extract first image from a post

Alan Castonguay alan at verselogic.net
Sun Nov 23 03:01:02 GMT 2008


Why not get the first image attachment instead? Less parsing of HTML.

Alan

Sent from my iPhone

On 22-Nov-08, at 19:34, "Alex Hempton-Smith"  
<hempsworth at googlemail.com> wrote:

> Hi all,
> I've created a custom loop to return the last 4 posts, and I need to  
> extract
> the first image from each post. Is there a way of possibly searching
> the_content for an image and outputting the first one the search  
> finds?
>
> I'm not really a PHP guru but I'm very eager to learn!
>
> Many thanks,
> Alex
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list