advantage_gallery_image_ids

The Advantage advantage gallery image ids function.

Description

advantage_gallery_image_ids( $content ); 

Parameters (1)

0. $content
The content.

Usage

  1. if ( !function_exists( 'advantage_gallery_image_ids' ) ) { 
  2. require_once '/inc/lib-general.php'; 
  3.  
  4. // The content. 
  5. $content = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = advantage_gallery_image_ids($content); 
  9.  

Defined (1)

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

/inc/lib-general.php  
  1. function advantage_gallery_image_ids( $content ) { 
  2. $image_ids = array(); 
  3. preg_match_all( '/\[gallery.*.\]/' , $content, $matches); 
  4. foreach ( $matches[0] as $match ) { 
  5. $str = str_replace (" ", "&", trim ($match)); 
  6. $str = str_replace ('"', '', $str); 
  7. $attrs = wp_parse_args( $str ); 
  8. if ( isset( $attrs['ids'] ) ) { 
  9. $ids = explode( ', ', $attrs['ids'] );  
  10. $image_ids = array_merge( $image_ids, $ids );  
  11. return $image_ids;