gerald@wpcustoms
Member
Posted 2 years ago #
On the OVERVIEW page nextgen gallery tells how many images are in the database:
At a Glance
100 Images
20 Galleries
5 Albums
Is there a way to display these infos outside the admin area?
I´d like to use it in the templates - thinking of something like this: <?php ngg-overview('images','galleries','albums') ?>
Thanks for any help and cheers to alex for this awesome plugin.
This is the code you need to count the images :
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") );
gerald@wpcustoms
Member
Posted 2 years ago #
works like a charm. Thanks a lot.
muzizzle
Member
Posted 2 years ago #
Hi guys, this is exactly what i'm looking for but I'm no coder.
How exactly would I go about putting this to use?
As in a page with:
"This site currently has X number of pics."
Thanks
Muz
CookiesForDevo
Member
Posted 2 years ago #
This should work:
"This site currently has <?php echo $images; ?> number of pics."
Hi,
Whereabouts do I add the code below ?:
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") );
To allow me to use :
"This site currently has <?php echo $images; ?> number of pics."
thanks
Sam