Sometimes we need to show total image count for a specific gallery. Nextgen gallery offers total images, total albums and total galleries by three different queries. They are bellow:
global $wpdb; $images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") ); $galleries = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery") ); $albums = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggalbum") );
How to count images for a specific gallery?
We can count the total image number easily by using the first query. But when we need to count the total number of image for a specific gallery, then that will be a question
Just kidding, it’s so simple. just check the following code bellow:
global $wpdb; $count = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = $your_gallery_id") );
That’s all
The post Show image count for a specific gallery in Nextgen Gallery appeared first on Blog - Flourish Pixel.