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