Skip to main content
added 68 characters in body
Source Link
Cristian
  • 1.4k
  • 10
  • 14

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="<?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 :)

Using your above code:

<?php 
global $wpdb; 
$images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = {$gallery->ID}") ); ?> 
<a rel="prettyPhoto" href="<?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 :)

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="<?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 :)

Source Link
Cristian
  • 1.4k
  • 10
  • 14

Using your above code:

<?php 
global $wpdb; 
$images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = {$gallery->ID}") ); ?> 
<a rel="prettyPhoto" href="<?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 :)