Thanks to @Rarst who led me in the right direction to answer this question!
What do you get if you var_dump() return of what doesn’t work,
especially wp_get_attachment_img_src()? Do you have WP_DEBUG enabled?
– Rarst
function product_images() {
global $post;
$attachments = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => 0,
'post_parent' => $post->ID,
'exclude' => get_post_thumbnail_id()
) );
if ( $attachments ) {
// $content needed to be just = not .= to start out the variable
$content="<div class="productimgs">";
foreach ( $attachments as $attachment ) {
// The correct function to retrieve the needed URLs
$imgthumb = wp_get_attachment_image_src( $attachment->ID, 'thumbnail' );
$imgfull = wp_get_attachment_image_src( $attachment->ID, 'full' );
$content .= '<a class="thickbox" href="'.$imgfull[0].'"><img class="productimg" src="'.$imgthumb[0].'" /></a>';
}
$content .= '</div>';
}
// Most importantly, this needed to be an echo not a return
echo $content;
}
Thanks again Rarst for leading me to the answer!