[wp-hackers] ordering by a custom field

Simon Blackbourn piemanek at gmail.com
Wed May 12 21:55:06 UTC 2010


> En/na Brian Fidler ha escrit:
>
>> Thanks, I'm using a custom query because I'm also using the NextGen
>> Gallery
>>
>> and I need to query based on both NGG and custom fields.
>>
>> Is there a way to access data from NGG with $wp_query, I wasn't able to
>> find
>> anything.
>>
>>

You can use $wpdb->get_results to retrieve data from nextgen gallery tables
(as in fact you can from tables created by any WordPress plugin).

The best way to figure out how is to look in nggfunctions.php, search for
SELECT and see how the queries are constructed in there.

Use PHPmyAdmin to see the tables, fields and datatypes (nextgen gallery
creates three tables I believe).

Simon


More information about the wp-hackers mailing list