A screenshot of the result of the inaturalist plugin, a grid of images. Overlaid with shortcode and snippet of php

I’ve been playing a little with WordPress yesterday. A while back I made the very simplest plugin to display my latest iNaturalist submissions. iNaturalist has a API so I made a short code that would then use JavaScript to pull in the pictures once the page loaded.

The only problem with that is that when the page loaded it just displayed a div with ‘loading’ then replaced that with the images when a script pulled that in. This appeared in the RSS feed too.

I thought that it might be better to do this server side so the images would show in an RSS feed.

This worked out ok once I had remembered lines need to end in semi-colons in php. It was still very basic so I ran it past Claude.ai and asked for security and caching advice. It made a couple of suggestions which I read up a little about and implemented.

I’ve tried using AI for a few code ideas and I am beginning to see what does and doesn’t work. What doesn’t work for me is to ask it to build a whole idea. This has nearly always ended up in problems which seem to loop around. What does work is to ask for somethings specific. In this case I uploaded the plugin to Claude and asked it to find any security problems. It did and suggested some fixes. I am sure that these are simple things that any WordPress developer would carry out without thinking about.

I’ve also found getting basic information around a function works well with AI. For example Claude suggested using the transient to cache the data from the API. Asking ChatGPT to explain transient gave me a quick handle on the function. (I am sure Claude would have explained too).

Anyway I have made some progress.

This was a good day:

Meadow BrownBumble BeesRobinGrey HeronOspreyMeadow BrownLittle Egret

The above produced with this shortcode:

[[inaturalist user="troutcolor"  on="2024-07-30"]]

I’d now like to add some more ideas: names looking a little prettier than the description tooltip, maybe a lightbox view with more information and a link to iNaturalist. But I am not in any rush.