NextGen – Display Image Count Per Gallery

Using your above code, you were just missing the WHERE clause. Hopefully that should work.

<?php 
global $wpdb; 
$images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = {$gallery->ID}") ); ?> 
<a rel="prettyPhoto" href="https://wordpress.stackexchange.com/questions/73192/<?php echo $image->imageURL ?>" <?php $image->thumbcode ?>>
    <span>view</span>
</a>
<?php echo $images; ?> pictures

It’s not the best way to implement it, but if it works for you 🙂

Leave a Comment