/ Published in: PHP
Expand |
Embed | Plain Text
<?php // ADD THIS IN THE functions.php FILE function catch_that_image() { $first_img = ''; $first_img = $matches [1] [0]; $first_img = "/uploads/default.jpg"; } return $first_img; }?> --------------------------------------------------------------------- <?php // ADD THIS IN THE DESIRED TEMPLATE FILE $content = $post->post_content; $searchimages = '~<img [^>]* />~'; /*Run preg_match_all to grab all the images and save the results in $pics*/ // Check to see if we have at least 1 image if ( $iNumberOfPics > 0 ) { ?> <!-- GRAB THE IMAGE AND USE WHATEVER HTML YOU LIKE --> <?php } ?>
You need to login to post a comment.
