fb_pixel

How to display the number of photos in the Nextgen Gallery (Wordpress) open gallery?

Development | Web Development
Description
How can I display the number of images in the Nextgen Gallery open gallery? I tried this code:

<?php
$imagescount=intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures"));
?>

it displays the total number of photos in all galleries.I also tried this option:

<?php $nggpage=get_query_var('nggpage');
if(! empty($nggpage)) {
	$ngg_options=nggGallery :: get_option('ngg_options');
	$img_counter=($nggpage - 1) *(int) $ngg_options['galImages'];
} else {
	$img_counter=0;
}
foreach($images as $image): ++ $img_counter;?>

But it only displays the number of images per page.

Is it possible to somehow display the number of images of the gallery itself?
For the gallery, use the nextgen_pro_thumbnail_grid template.
Attachments
No attachments
Info
Description
He asked himself, he answered) I leave the solution of the question, suddenly he will help someone)))
In general, everything is very simple:

<?php
  global $wpdb;
  //Number of all photos on the site
  $imagescount=intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures"));
  //Number of all galleries on the site
  $galleriescount=intval($wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery"));
  //Number of images in an open gallery
  $total=$displayed_gallery->get_entity_count();
?>


Well, then "echo" we deduce what you need.

<?php echo $total; ?>

on January 14th, 2020 (10:17 pm)
All coments
This job has not been commented yet.