get custom field in NextGEN widget
-
I’m using NextGEN Gallery 1.8.3 and NextGen Custom Field 1.1.2
I’ve added a field “link”, and try to display it in the ngg widget.
But from what I can see, the widget is build using js, and loading data through json. And the json seems to have no information on custom field, only about standard field.update
I’ve spend one more hour searching and trying stuff before posting, and I’ve get get thing together. It’s dirty crap, but it’s getting the job done.In order to get get my custom data in the json, I’ve add an outer join to the get_gallery function, in ngg_db.php, which get data from custom field and concat everything. I end up with `SELECT SQL_CALC_FOUND_ROWS tt.*, t.*, l.pid, l.field_value AS link
FROM $wpdb->nggallery AS t
INNER JOIN $wpdb->nggpictures AS tt
ON t.gid = tt.galleryid
LEFT OUTER JOIN “.$pre.”nggcf_field_values AS l
ON tt.pid = l.pid
WHERE t.gid = %d {$exclude_clause}
ORDER BY tt.{$order_by} {$order_dir} {$limit_by}”`. I’m pretty sure thing will simply break if I add a second custom field, but right now, thing work.
- The topic ‘get custom field in NextGEN widget’ is closed to new replies.