get meta value using get_result
-
I want to get a json print with some of my posts in a specific category.
I want ex.: title, category and then some meta-data with the keyes lat and lon (coordinates).
Case:
[{"lat":"55.395263","lon":"10.385723","post_title":"Mammas Pizza","post_cat":"Fast Food")"}
Here is one of my tests:
$result = $wpdb->get_results("SELECT a.*, b.* FROM $wpdb->posts a LEFT JOIN $wpdb->postmeta b ON b.post_id = a.ID"); if (!$result['error']) { print json_encode($result); } else { errorJson('fail'); }
How can I get a json with these data using get_results?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get meta value using get_result’ is closed to new replies.