Okay, so I found this code online that allows you to add the option of how many thumbnails you want to show in the gallery shortcode.
The code below is what they say to add to the functions.php file
function get_random_gallery_images(){
global $wpdb,$post;
$ids = "";
$counter = 0;
$number_of_posts = 4;
$args = array(
'post_type' => 'attachment',
'numberposts' => 4,
'post_status' => null,
'orderby' => 'rand',
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
if ($counter != 0) {
$ids .= ','.$attachment->ID;
}
else {
$ids .= $attachment->ID;
}
$counter++;
}
}
return $ids; }
Then they say add this code below to the loop
$attachment_ids = get_random_gallery_images();
echo do_shortcode('[ gallery columns="4" include="'.$attachment_ids.'" link="file" ]');
But my problem is, they didn't say where in the loop to add the code. Does anyone know where I can add this code? Also if you have a better solution to achieve what I am asking, please share :)