How create own custom smart gallery & shortcode using NextGen Gallery!

For integrate custom Gallery using NexnGen Gallery just follow code given below
You can add JQuery Image gallery in your wordpress site using this code.
/** Custom gallery function **/
function rgallery_func($atts) {
'id' => 'no foo',
'bar' => 'default bar'
), $atts));

$ID=$atts[id]; //retrieve NextGen Gallery ID passed in short code

/** Get Main gallery image root path **/

$Qryslug="select path from wp_ngg_gallery where gid='$ID'";
$queryslug = mysql_query($Qryslug);

/** Get gallery images **/

$Qry="select * from wp_ngg_pictures where galleryid='$ID'  and exclude=0 order by pid desc";
$query = mysql_query($Qry);
if (mysql_num_rows($query) > 0) {

echo ' <div id="gallery">


$Titlle =stripslashes($Arry['alttext']);
$FileName =$Arry['filename'];
$descr =stripslashes($Arry['description']);
echo '<li>
<a href="'.home_url('/').$GalleryPath.'/'.$FileName.'"  title="'.$Titlle.'">
<img src="'.home_url('/').$GalleryPath.'/thumbs/thumbs_'.$FileName.'"  title="'.$Titlle.'" alt="'.$descr.'">
echo '</ul>
} else {
echo '<img src="' . home_url('/') . 'wp-content/themes/suchdesign/images/no-image.jpg">';


add_shortcode('rgallery', 'rgallery_func');//Just add short code [rgallery id=GalleryID] in your page

 //Add custom JQuery in header


function add_jquery_header()


echo '<script src="your-root-path/filename"></script>\n';

echo '<script src="your-root-path/filename"></script>\n';


For any further enquiry please contact to our support team


Sr. Software Engineer

Posted in PHP, Wordpress
One comment on “How create own custom smart gallery & shortcode using NextGen Gallery!
  1. davy says:

    very helpful thanks

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Recent Posts