Created
March 2, 2014 17:18
-
-
Save bgallagh3r/9309955 to your computer and use it in GitHub Desktop.
All NextGen Galleries in Lightbox - Loads all galleries on a single page via lightbox instead of going to the actual gallery page. Just add the files appropriately then use this shortcode `[album id=0 template=lightbox]` id of 0 will force NGG to load all galleries. What I did instead however was set the default compact album to use the lightbox…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// /wp-content/themes/YOURTHEME/nggallery/album-lightbox.php | |
// To set this theme, go into Gallery > Gallery Settings and change the template to album-lightbox. | |
/** | |
Template Page for the album overview | |
Follow variables are useable : | |
$album : Contain information about the album | |
$galleries : Contain all galleries inside this album | |
$pagination : Contain the pagination content | |
You can check the content when you insert the tag <?php var_dump($variable) ?> | |
If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?> | |
**/ | |
?> | |
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($galleries)) : ?> | |
<div class="ngg-albumoverview"> | |
<!-- List of galleries --> | |
<?php foreach ($galleries as $gallery) : | |
$images = nggGetGallery( $gallery->gid ); | |
if(!empty($images)) : | |
?> | |
<div class="ngg-album-compact"> | |
<div class="ngg-album-compactbox"> | |
<div class="ngg-album-link" id="<?php echo $gallery->name ?>"> | |
<?php | |
$imgcntr = 0; | |
foreach ( $images as $image ) : | |
if ( $imgcntr == 0 ): ?> | |
<a href="<?php echo $image->imageURL ?>" title="<?php echo str_replace("\"", "'", $image->description); ?>" <?php echo $image->thumbcode ?> > | |
<img class="Thumb" alt="<?php echo $gallery->title ?>" src="<?php echo $gallery->previewurl ?>"/> | |
</a> | |
<?php $imgcntr++; ?> | |
<?php else: ?> | |
<a href="<?php echo $image->imageURL ?>" title="<?php echo str_replace("\"", "'", $image->description); ?>" <?php echo $image->thumbcode ?> ></a> | |
<?php endif; endforeach; ?> | |
</div> | |
</div> | |
<h4><a class="ngg-album-desc" title="<?php echo $gallery->title ?>" style="max-width:110px;" href="<?php echo $gallery->pagelink ?>" ><?php echo $gallery->title ?></a></h4> | |
<?php if ($gallery->counter > 0) : ?> | |
<p><strong><?php echo $gallery->counter ?></strong> <?php _e('Photos', 'nggallery') ?></p> | |
<?php endif; ?> | |
</div> | |
<?php endif; endforeach;?> | |
<!-- Pagination --> | |
<?php echo $pagination ?> | |
</div> | |
<?php endif; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom function for displaying all gallery images on a single page | |
* @param int $galleryID | |
* @param string $template | |
* @param boolean $images | |
* @return array | |
*/ | |
function nggGetGallery( $galleryID, $template = '', $images = false ) { | |
global $nggRewrite; | |
$ngg_options = nggGallery::get_option('ngg_options'); | |
//Set sort order value, if not used (upgrade issue) | |
$ngg_options['galSort'] = ($ngg_options['galSort']) ? $ngg_options['galSort'] : 'pid'; | |
$ngg_options['galSortDir'] = ($ngg_options['galSortDir'] == 'DESC') ? 'DESC' : 'ASC'; | |
// get gallery values | |
$picturelist = nggdb::get_gallery($galleryID, $ngg_options['galSort'], $ngg_options['galSortDir']); | |
return $picturelist; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment