I recently moved another blog of mine back to “plain” WordPress, and in the process added microformats2 support to its Twenty Twenty child theme. Some remarks: I’ve yet to add a
u-photo class to featured images, I used a bit of a trick to get post metadata to show below short-form posts rather than above, and I’ve also completely hidden the “regular” comment form—I’m more of a Webmention type of guy.
I’m adding an
h-feed class to the
body of feed pages only—i.e., home, search, different kinds of archives. I’m adding
h-entry to posts. And wrapping post content in a
div with either an
p-summary class, if such a class isn’t already present—it could’ve been added by, e.g., the Micropub plugin when the post was first created.
I’m also adding a Mastodon syndication link, if there is one. I’m using a post meta field set by my Share on Mastodon plugin. Also, I’m displaying—via Appearance > Menus—a Mastodon icon in my “social menu,” which requires adding support for Fediverse icons. To do so, I attach a callback function to
walker_nav_menu_start_el. For the time being, this callback function relies on the Add Fediverse Icons to Jetpack plugin, and Jetpack itself—although it’ll work even with all of Jetpack’s modules disabled.
The other big thing is author-related Microformats.
The biggest issue so far? Twenty Twenty’s (really big)
twentytwenty_get_post_meta not being pluggable. If the original had been wrapped in an
if ( function_exists( 'twentytwenty_get_post_meta' ) ), we could’ve overridden that and call it a day. The child theme, in fact, would’ve consisted of only two files:
functions.php! Because it isn’t, though, I had to essentially rename a copy of this function and include modified versions of each template that calls it.
(The reason for wanting to edit
twentytwenty_get_post_meta, of course, is to get author-related Microformats in there.)
It doesn’t have to stop there, though. Site-specific modifications are best made in a site-specific must-use plugin. I’m using one to register my Micropub config, add a link to my Microsub account, and so on.