I had ChatGPT write a WordPress plugin for me
I’m really enjoying the Made by Minimal theme that powers this website. It is ideal for artists like me who create a bazillion things and want a clean presentation but with good gallery and project (aka hierarchical gallery) support.
One of the better features of this theme is what it is missing… it doesn’t come with any plugins or fancy editors like Divi. The backend WordPress dashboard is clean and minimal. No excess garbage or heavyweight plugins to slow the website down. And less code means fewer targets for baddies who want to compromise your website.
Now don’t get me wrong. Divi is a great design-oriented tool for building marketing websites. But as an artist, I really only want to post what I’m working on. The last thing I want to do is design. It is one of the reasons I stayed away from Squarespace. They got rid of themes and the first thing you need to do when you sign up with them is to design your site. Yuck!
The folks at Minimal have thought of most things that I want, but one thing that was missing was support for OpenGraph og:description and og:image tags, which is a nice-to-have feature when sharing your posts or pages on social media. For instance when you post to Bluesky, it looks for og:description and og:image to provide a short excerpt and visual thumbnail to your followers.
I tried a few available OpenGraph plugins but none of them were able to pickup the sidebar content that is a feature of the Made theme. So I asked ChatGPT to write it for me. You can see the code in these two Gists:
The first plugin looks for gallery_description post meta, which is the sidebar content and uses that for og:description if it exists. Otherwise it falls back to the post excerpt, and if that doesn’t exist, it falls back to the first 30 words of the content.
The second plugin adds the ability to add an og:image to any page or post. Why not just use the featured image, which is built into WordPress? Because the featured image is displayed prominently as part of the page or post, and it just doesn’t look right to me. This allows me to have a slightly different version of imagery that’s included in the content, or even when I don’t want any imagery in the content.
Now almost all of my pages and posts show a nice description and thumbnail when I post them to social media.