evolve_get_first_image

Get first image.

Description

evolve_get_first_image(); 

Usage

  1. if ( !function_exists( 'evolve_get_first_image' ) ) { 
  2. require_once '/library/functions/basic-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = evolve_get_first_image(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/library/functions/basic-functions.php  
  1. function evolve_get_first_image() { 
  2. global $post, $posts; 
  3. $first_img = ''; 
  4. $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); 
  5. if (isset($matches[1][0])) { 
  6. $first_img = $matches [1][0]; 
  7.  
  8. return $first_img;