I have a WordPress page template where all NextGEN galleries are displayed on a page:

<?php global $nggdb; ?>
<?php global $wpdb; ?>
<?php $galleries = $nggdb->find_all_galleries('gid', 'DESC'); ?>
<?php usort($galleries, function($a, $b) { return $a->gid < $b->gid; }); ?>
<div class="container page-album-gallery-view">
    <div class="container-1">
        <div class="col-lg-12">
            <h1><?php _e('Album gallery view','bbhghtemplate'); ?></h1>
        <div class="col-lg-12 abox">
            <?php foreach($galleries as $key =>  $value) : ?>

                <div class="thumbnail <?php if(($key === 0) || (($key%9) === 0)) echo('big');?>">
                    <div class="img-wrapper">
                        $_big = nggdb::find_image($value->previewpic)->get_href_link();
                        if(preg_match('/href="([^"]+)"/Us', $_big, $match)){
                                $_big = $match[1];
                        $_thumbnail = nggdb::find_image($value->previewpic)->cached_singlepic_file(728, 728, 'crop');
                        <img src="<?php echo $_thumbnail; ?>"/>
                        <div class="img-overlay">
                            <a href="<?php echo(get_permalink(icl_object_id(282, 'page', true)) . '?slug=' .sanitize_title($value->title) . '_' . $value->gid); ?>" class="btn btn-lg btn-primary">
                                <?php _e('View gallery','bbhghtemplate'); ?>
                    <div class="thumbnail-bottom">
                        <h4><?php echo($value->title); ?></h4>
                        <div class="count-block">
                            <?php  $_imgs = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."ngg_pictures WHERE galleryid = " . $value->gid, ARRAY_A);?>
                            <span><?php echo(count($_imgs)); ?></span>
                            <span class="ico"></span>
            <?php endforeach; ?>

I would like to modify this and get all galleries inside the album - by picking them out of an album ID '1'

Has anyone done something similiar before?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.