Hello,
I needed this feature, too and therefore implemented it:
// Finally check the galleries
$pattern = get_shortcode_regex();
if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
&& array_key_exists( 2, $matches )
&& in_array( 'gallery', $matches[2] ) )
{
foreach($matches[2] as $index => $tag){
if($tag == 'gallery'){
$params = shortcode_parse_atts($matches[3][$index]);
if(isset($params['ids'])){
$ids = explode(',', $params['ids']);
foreach($ids as $id){
$id = (int) $id;
if($id > 0) $attachment_ids[] = $id;
}
}
}
}
}
I also added functionality to make the IDs unique before the credits are requested from the DB:
// Make sure the ids only exist once
$attachment_ids = array_unique($attachment_ids);