![]() ![]() Output the filenames and any captions that currently exist.Put them in the order that the images were taken.Figure out how to retrieve available data for all of the images attached to this particular page.That makes sense because the files weren’t always uploaded or attached in the order in which they should appear in the gallery. Also, just judging by the image titles, I can see that they’re not being returned in the proper order. We’ll have to look into increasing that limit. Ten must be a default limit for the API response. ![]() The first thing I noticed was that there are only 10 media items in the JSON response, while there are 255 images attached to the page. That’s the ID of the page that contains our photo gallery. That gives us a nice JSON-formatted list of the media whose parent ID is 1187. It turns out that it’s pretty simple to do what we wanted!įirst, I checked the response from this URL: I thought this would be a good opportunity to learn a little about the WordPress REST API, which I’ve been hearing about lately but really know nothing about. There was no way I wanted to do this manually for 255 images. The document would contain each image’s filename and its caption, if one existed, one per line. After most of the photos were added, Rich asked if I could create a Google Doc to share with him so he could help to create and edit captions for the images. Over the past few weeks, Rich and I have been adding to our WordPress photo gallery from this year’s trip to Maine. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |