WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: NextGEN Gallery] display amount of images\galleries\albums (6 posts)

  1. gerald@WPcustoms
    Member
    Posted 5 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.

  2. Alex Rabe
    Member
    Posted 5 years ago #

    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") );
  3. gerald@WPcustoms
    Member
    Posted 5 years ago #

    works like a charm. Thanks a lot.

  4. muzizzle
    Member
    Posted 5 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

  5. CookiesForDevo
    Member
    Posted 4 years ago #

    This should work:

    "This site currently has <?php echo $images; ?> number of pics."

  6. swam22
    Member
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.