I’m using the JSON API plugin for WordPress( http://wordpress.org/plugins/json-api/ ) to dynamically load posts into my website. I’m trying to set up a lightbox-style gallery where the images get displayed as soon as the lightbox is opened.
My Goals:
- (Preferred) Use a method (like example below) to get the url of the image instead of the id which I get now
or - (Not preferred, but will do) Get the image url using another call (but then I would have to make a seperate call for each post), by using the id that I get from the image
Example: (Here is what I have now):
$.getJSON('/?json=get_recent_posts&post_type=slides-verhuur&custom_fields=image',
{},function(data){console.log(data);
});
The bottom line is that this is just returning the id for the image. (More details below)
The data which is returned contains an array with posts which each have a custom field attribute. However, the “image” custom field (the only one for this specific post type), only contains the value “80” which is the id for the image which is attached to this post.
I’ve used the advanced custom field plugin to add an image field to this custom post type.
Thanks in advance!