A problem with WordPress’ built-in picture gallery is that it will include a featured image in the gallery itself if one exists.

You can quickly take care of it with this function, courtesy of TheDeadMedic from across the pond.

I keep this code handy in my sites funcitons.php file.

Removing the Featured Image from the Gallery

Put this function (and the add_filter command at the bottom of it) in your functions.php file.

If you don’t have one or don’t know where it is, it goes in your theme’s folder and is automatically found by WordPress.

function exclude_thumbnail_from_gallery($null, $attr)
    if (!$thumbnail_ID = get_post_thumbnail_id())
        return $null; // no point carrying on if no thumbnail ID
    // temporarily remove the filter, otherwise endless loop!
    remove_filter('post_gallery', 'exclude_thumbnail_from_gallery');
    // pop in our excluded thumbnail
    if (!isset($attr['exclude']) || empty($attr['exclude']))
        $attr['exclude'] = array($thumbnail_ID);
    elseif (is_array($attr['exclude']))
        $attr['exclude'][] = $thumbnail_ID;
    // now manually invoke the shortcode handler
    $gallery = gallery_shortcode($attr);
    // add the filter back
    add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);
    // return output to the calling instance of gallery_shortcode()
    return $gallery;
add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);