Ok so I am using the [multigallery] function and it works fine, but one thing I want to add.
Here is the code that I am using for the multigallery in my functions.php file
function get_random_gallery_images(){
global $wpdb,$post;
$ids = "";
$counter = 0;
$number_of_posts = 6;
$args = array(
'post_type' => 'attachment',
'numberposts' => 6,
'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; }
function multi_gallery_shortcode()
{
$attachment_ids = get_random_gallery_images();
return do_shortcode('[gallery columns="6" order="ASC" orderby="menu_order" include="'.$attachment_ids.'" link="gallery"]');
}
add_shortcode('multigallery', 'multi_gallery_shortcode');
And here is how it looks
It's working Great but here are some functions that I want to add
I want to add the photo count to the shortcode with css ass well, and the title above the thumbnails, but the problem is, I don't know where to add the codes or the <div>
codes either, can anyone help me with this problem.
Here is a code i have to call the number of photos, but where do i add this for it to show up in the [multigallery] shortcode.
<?php
$attachments = get_children(array('post_parent'=>$post->ID));
$nbImg = count($attachments);
echo '<span class="galNum">'.$nbImg.'</span> Photos.';
?>