## Function to do searchs on gallery pics from NextGen Gallery plugin
##
## 2 vars : (1) $keywords (usually coming from the standard search query from wordpress)
## (2) $numberPicCol (number of pic by row, if null it takes 4 )
function ngg_get_search_pictures ($keywords, $numberPicRow = NULL) {
global $wpdb;
$count=1;
if (!$numberPicRow) { $numberPicRow = "4"; }
$nngquery = "
SELECT pid,description,alttext
FROM wp_ngg_pictures
WHERE MATCH (description, filename, alttext) AGAINST ('*$keywords*' IN BOOLEAN MODE)
AND exclude = '0'
";
$pictures = $wpdb->get_results($nngquery, ARRAY_A);
if ($pictures) foreach($pictures as $pic) {
$out .= '';
$out .= '
';
$out .= "\n";
if ($count == 0) {
$out .= "
";
}
++$count;
$count%=$numberPicRow;
}
return $out;
};