Post formats (not quite) in 2021 WordPress

Post-type-specific CSS doesn’t sound all that sexy

Justin Tadlock is apparently on a one-man mission to revive the feature so a) I thought I would weigh in and b) it so happens that I have discovered something that does most of what I want from “post-type-specific CSS”.

Post formats came in many shapes and sizes but I think we all remember them best for the “aside” – a way to add short, quick posts to WordPress without giving them the same prominence as regular posts. Sounds familiar? Yeah, it’s essentially social media posts, that only people on your RSS feed will ever see. Which I actually think is kinda great but yeah, things didn’t work out that way – in more ways than one.

I do agree though, that many theme layouts would be well served by accomodating asides or some kind of post format as it would add a bit of variety to an otherwise rather boring column-row layout. Break it up a bit. Give a standard blog site a bit of the portfolio feel without the need to break out the camera.

On to my discovery. I have recently switched a lot of posts over from my theme’s default template to it’s cover template. Arguably templates do a lot of what people might have wanted from post formats but that’s not what I’m about here. The cover template ask the featured image to do a lot more heavy lifting, looks-wise and as a result I have changed a lot of featured images. Because the header is now on top of the image that means that I need a fair amount of contrast with the white heading text. Not all images, like the one above, can deliver that and I’m no GIMP pro. So I resort to a CSS semitransparent gradient in the foreground, adding a bit of shadow to the lower part of the image when that is called for. “When it’s called for” is ajudged by me on a post-to-post basis.

At first, I made use of the fact that each post is ensconced in it’s own special CSS id (#post-xxxx applied to the article element). The discovery was that article also bears every single tag as a CSS class. I have no idea why, as I assume that tag-filtering is done at the database level, not by listing every single post on a page and then applying CSS blocking to the result.

The advantage for me is that I can use special tags that match custom-made CSS classes in my child theme to get rules applied to posts. Not because those posts are special in some meaningful, semantic way. Just because I can see that they would look better if this special rule was applied. The only downside is that my tags get a bit messy, with a mixture of tags about content and tags about form. But then, it’s not like tag clouds are a thing anymore, anyway.

Could I use it to ressurect post formats? Not really, because the main page and the theme in general would still be oblivious. But maybe there could be simple ways inside the post to signal that something wasn’t really as important and serious as the regular output. Or you can, of course, just put that kind of thing on Twitter.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.