Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Claude Vedovini

    (@cvedovini)

    hello, I’ll check it out, thanks for the info 🙂

    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);
    Plugin Author Claude Vedovini

    (@cvedovini)

    looks great, I will add that to the next release, thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Credits for Galleries’ is closed to new replies.