Gallery Only Displaying One Thumbnail

My image galleries are showing only one thumbnail in the post the gallery sits in.

My single.php markup can be found here:

Additionally, previous_image_link and next_image_link are not displaying when the image is clicked (these would lead to the other images in the gallery).

My entire image.php markup can be found here:

My gallery shortcode:

Solutions Collecting From Web of "Gallery Only Displaying One Thumbnail"

Try this and verify that the attachments come back correctly when queried directly:

// helper function to return first regex match
function get_match( $regex, $content ) {
    preg_match($regex, $content, $matches);
    return $matches[1];

// Extract the shortcode arguments from the $post
$shortcode_args = shortcode_parse_atts(get_match('/\[gallery\s(.*)\]/isU', $post->post_content));

// get the attachments specified in the "ids" shortcode argument
$attachments = get_posts(
        'include' => $shortcode_args["ids"], 
        'post_status' => 'inherit', 
        'post_type' => 'attachment', 
        'post_mime_type' => 'image', 
        'order' => 'menu_order ID', 
        'orderby' => 'post__in', //this forces the order to be based on the order of the "include" param

echo 'gallery count:' . count( $attachments );

If that count is correct, then the gallery shortcode should be returning correctly. Let me know what that returns.

It ended up being a problem with a code to pull a custom number of posts via an options panel.