parameter_value pairs * * @return array updated substitution parameter name => value pairs */ public static function mla_gallery_item_values_filter( $item_values ) { /* * We use a shortcode parameter of our own to apply our filters on a * gallery-by-gallery basis, leaving other [mla_gallery] instances untouched. * If "mla_viewer_caption" is not present, we have nothing to do. Here is * an example of how the custom parameter can be used: * * [mla_gallery ids="2621,2622,2623" mla_viewer=true mla_viewer_caption="{+title+}"] */ if ( ! isset( self::$shortcode_attributes['mla_viewer_caption'] ) ) { return $item_values; } $extension = pathinfo( $item_values['file'], PATHINFO_EXTENSION ); if ( false === strpos( self::$all_display_parameters['mla_viewer_extensions'], $extension ) ) { return $item_values; } // You can use MLAOptions::mla_get_data_source() to get anything available. $mla_viewer_caption = str_replace( '{+', '[+', str_replace( '+}', '+]', self::$shortcode_attributes['mla_viewer_caption'] ) ); $data_source = array( 'data_source' => 'template', 'meta_name' => $mla_viewer_caption, 'option' => 'text' ); $mla_viewer_caption = MLAOptions::mla_get_data_source( $item_values['attachment_ID'], 'single_attachment_mapping', $data_source, NULL ); $item_values['caption'] = $mla_viewer_caption; return $item_values; } // mla_gallery_item_values_filter } // Class MLAViewerReplacement /* * Install the filters at an early opportunity */ add_action('init', 'MLAViewerReplacement::initialize'); ?>