Created
May 30, 2011 21:40
-
-
Save erkattak/999520 to your computer and use it in GitHub Desktop.
WordPress - Pull NextGEN Gallery Preview Image using Gallery ID
This file contains 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 | |
$gallery_id = 1; // Use the PODS column, custom post field or however you would get this ID | |
$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A); | |
if(!empty($results[0]['path']) && !empty($results[0]['filename'])) : | |
$imgpath = $results[0]['path'].'/'.$results[0]['filename']; | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well ... I created a github account just to thank you. You're my day's hero :) I've been struggling with trying to customize this WP plugin using reponsive imaging. Guess using BDD is at the end the easiest way to hack those "user friendly" plugins that are pain in the ass to use as a developer.
Thx again, you really helped me tonite
Sebastien