Radiohead albums as a timeline of my work history

I’m in a Radiohead mood today, listening to A Moon Shaped Pool, and I decided to kill some time (a.k.a. distract myself from work) by looking for a “listicle” ranking their albums, to see if I agreed with it. Here’s what I found. Pretty good. I would swap the positions of Amnesiac and Pablo Honey, and probably knock The Bends down to fifth (moving A Moon Shaped Pool and In Rainbows up by one each). Honestly I have barely listened to Pablo Honey (ever) or King of Limbs (beyond about a month after its release)… and I haven’t really listened to Hail to the Thief since In Rainbows came out.

It’s also hard for me to process the fact that they only have 9 studio albums… back in the early 2000s when I listened to them a lot there were a handful of EPs, extended singles, a live album, etc. that made their catalog seem a lot bigger.

(Also yes I did notice the author got the release year of Pablo Honey wrong… it was 1993, not 1995!)

I can tell when some of these were released by the mental image I have of where I was when I was listening to them.

Pablo Honey (1993) and The Bends (1995) — I didn’t really listen to Radiohead in the ’90s, but I remember these being on the periphery of my awareness in college.

OK Computer (1997) — I first heard this one in a friend’s studio apartment in Loring Park, Minneapolis shortly after it was released, and now I was paying attention to these guys. (We were living in California at the time, but I spent the night hanging out with some college friends when I came back to visit my family in Minnesota.)

Kid A (2000) — I remember first talking about it with my bandmates (one of whom was a coworker at my job at the time) at a rehearsal in our drummer’s basement in the northwest suburbs of Minneapolis.

Amnesiac (2001) — I was working from home for the first few months after we moved to Atlanta, and I listened to this sitting in my basement workspace.

Hail to the Thief (2003) — Another basement… this time I was working for a travel industry startup with a terrible early 2000s tech startup name (and long-since defunct), and my desk was in the basement of a converted house in the northern Atlanta suburbs.

In Rainbows (2007) — The first pay-what-you-want album! I splurged for the big vinyl-plus-CD-plus-coffee-table-book set. I most associate it with my home office in the back bedroom of our first house in Minneapolis.

The King of Limbs (2011) — My wife was teaching at the University of Minnesota when this came out, and I was already self-employed at that point. I would meet up with her on campus for lunch once a week, and on those days I would generally just hang around somewhere on campus with my laptop working. I always associate this album with sitting in the open area on the lower level of the then-brand-new Bruininks Hall.

A Moon Shaped Pool (2016) — Another one I immediately purchased on vinyl. This was spinning frequently in the storefront studio space I was renting at the time in the East Nokomis area of Minneapolis.

Oh yeah… since that listicle I linked to will probably be as dead as my old travel industry tech startup’s website when I want to look back on this in 10 or 20 years (eek), here’s my ranking as of right now:

9. The King of Limbs
8. Pablo Honey
7. Amnesiac
6. Hail to the Thief
5. The Bends
4. A Moon Shaped Pool
3. In Rainbows
2. OK Computer
1. Kid A

The lengths to which I will go to “Do It Wrong™”

First, let’s get one thing straight: WordPress is built on PHP. The Gutenberg/Block Editor team may love React more than anyone else outside of Facebook, but ultimately WordPress is still built on PHP, and the WordPress developer community is built of PHP developers.

It doesn’t have to be PHP. I mean, PHP is kind of a garbage language if I’m honest. But the point is, there is server-side processing happening. It is what makes it possible to dynamically assemble page output, and create separate data, functionality, and design layers in a web application. But for reasons I barely understand and certainly do not agree with, the Gutenberg team decided to make templates pure HTML. No PHP allowed. I feel like they’ve separated the wrong layers.

Anyway, the problem I’ve run into here is that I have perhaps become a bit too dependent upon the one place in Gutenberg where you can still write PHP: block patterns. Block patterns are PHP files, not HTML files like templates or template parts. So naturally I’ve been tempted to misuse block patterns. (Although it didn’t really become apparent to me that I was misusing them, until I was past the point of no return.)

I have always used Advanced Custom Fields extensively in my WordPress site development. And in the Gutenberg era, it’s made it possible for me to create custom blocks while still working primarily in the familiar world of PHP.

I’m getting better at creating block patterns, but today I discovered a way that I may be fundamentally misunderstanding them. I’m really kind of using them as template parts, I guess, but as a cheat way to get access to PHP. Specifically, I’ve been putting block patterns into my templates. Not as ways of dropping in a pre-formatted set of editable blocks in the Block Editor itself, but as “hardcoded” ways to include some PHP-driven elements in the non-editable parts of my page templates.

This has all been working perfectly well until today, when I decided I wanted to be able to drop the contents of an old-school ACF field into a block pattern I created. This pattern is for displaying some of the meta data about a post: post date, categories and tags, and now a new custom field: the byline.

Don’t say I should just use author fields; if you don’t understand a context where a news post might have an author who is not the person who is entering the post in WordPress (and who, in fact, does not even have a WordPress login) I don’t know what to tell you.

I figured, OK, this will be a no-brainer. I’ll just put this into the block pattern PHP file:

the_field('byline');


Oops… that didn’t work. Let’s try this:

the_field('byline', $post);


Hmm… still didn’t work. Oh sure, I need to get the global variable first:

global $post;
the_field('byline', $post);


Wow, that doesn’t even work. Well, what about this?

the_field('byline', get_queried_object_id());


Take a guess.

So, here’s the problem. Block patterns have no context. When a block pattern gets inserted into a page, then it does have context. So if I were to go and edit the post, and insert this block pattern into the actual post content, then it would display the data. (I guess… I didn’t try that until several steps later.) But that isn’t what I want. I don’t want the client to have to remember to insert this “post meta” block pattern at the top of every post. I want it in the template. That’s the whole point.

But if the block pattern is directly in the template, it doesn’t know the current post ID. More importantly, it has no way to even access the current post ID. I’m Doing It Wrong™.

Fine, I know I’m doing it wrong. But once again I feel like WordPress itself is fundamentally wrong here.

And I’m determined to do it my way, even if it’s “wrong,” dammit.

After probing several further layers deep on this (including trying to use the ACF shortcode in the block pattern — which is where I realized it does work if you insert the block pattern into the actual post content, but not in the template), I determined that there was really only one way to do it wrong that still actually works.

I created a custom ACF block designed solely to just output the value of any arbitrary custom field.

This is so unbelievably WRONG I can taste it. But it’s the only way I’ve found to do what, in all of my experience across nearly two decades of working with WordPress and PHP in general, seems like it should be a really freaking easy thing to do.

So, please, DO NOT UNDER ANY CIRCUMSTANCES DO WHAT I AM ABOUT TO SHOW YOU HERE. You’ve been warned.

OK. First, you need to have Advanced Custom Fields Pro installed, so you can use ACF Blocks. In your theme’s functions.php file, do this:

register_block_type(dirname(__FILE__) . '/blocks/acf-diw');


Then you need to make sure you have this hierarchy of files in your theme:

blocks/
	acf-diw/
		acf-diw.css
		acf-diw.php
		block.json


We’re not actually going to put anything in acf-diw.css at this point, but you might want it later.

Here’s what goes in the block.json file:

{
	"name": "acf/acf-diw",
	"title": "ACF DIW",
	"description": "",
	"style": "file:./acf-diw.css",
	"script": "",
	"category": "",
	"icon": "editor-code",
	"apiVersion": 2,
	"keywords": [],
	"acf": {
		"mode": "preview",
		"renderTemplate": "acf-diw.php",
		"postTypes": []
	},
	"supports": {
		"inserter": false
	},
	"styles": []
}


Then in your acf-diw.php file you need this. Note this is the absolute bare minimum code you need for this to work; I would recommend actually using the get_block_wrapper_attributes() function to allow you to include CSS classes, styles, an ID, etc. in the output — and my actual version does have that. This is just to key you in on what specifically makes this trick work. It’s not highly secure, but I think it’s reasonably safe, specifically because we’re checking to make sure we’ve passed in the name of a field, and that there’s actually a custom field on this page/post with that name, and we’re sanitizing the output.

<?php
global $post;
if (!empty($block['data']['field']) && $field_value = get_field(esc_attr($block['data']['field']), $post)) {
	echo '<span>' . wp_kses_post($field_value) . '</span>';
}


OK, now with all of that in place, here’s what you can put into a block pattern file and actually get the output of an ACF custom field that exists on that page/post:

<!-- wp:acf/acf-diw {"name":"acf/acf-diw","data":{"field":"byline"}} /-->


Replace “byline” with the name of your ACF field.

It works. But you didn’t hear it from me.


Side note: This does not work properly when it’s actually inserted into the page content as a regular block. As configured, it is strictly for use in block pattern files where you want to break what block patterns are apparently intended for. (That’s why we have the "inserter": false line in the JSON file.) You could build this in a way that would make it work properly as an inserted block, but why bother? That is, expressly, what the ACF shortcode is for.

OK, fine, DO use JPEG for your logo… here’s why

I have complained many times (OK, only those two times here on the blog, but countless other times to anyone within earshot) about people using JPEG for logos. It is bad, bad, bad.

But it just keeps happening.

Finally, I have stopped caring. Yes, go ahead and use JPEG for your logo. Send me the gnarliest, artifactiest, lowest-quality JPEG of your logo that you can find. And make sure it’s tiny. Like, 200 pixels wide or less.

Why?

Because I bill by the hour. I’m happy to fix your logo for you, and I will do it, whether you ask me to or not, whether you notice the difference or not, if this is what you send me as part of your project. (I can neither confirm nor deny that I might also write a blog post ranting about JPEG logos while I’m on the clock.)

Egads, I’ve never looked at that emoji closely. Are those dollar sign eyes with raised eyebrows, or closed eyes with dollar sign nostrils??? (Once you see it, you can’t unsee it.)

Surely you can’t be serious: Does Gutenberg REALLY do this???

I’m building a pair of new WordPress sites for a client, using a base block theme I created. My plan going in was to create two child themes, one for each site. But after I finished the first site, I realized that the differences between the two were entirely cosmetic, so I thought I would use the new global style variations feature to just create one child theme for both sites to use, letting the sites have their own separate theme.json files via the styles folder in the child theme. (Let’s call them site1.json and site2.json.)

The problem is, I have a few site-specific code customizations beyond what can be handled in the theme.json file. And, more importantly, I want to hardcode which style variation each site uses. No need to muck around with the Site Editor (a.k.a. “Full Site Editing”). I do not want the client to have any access to that feature whatsoever.

So, I figured… OK, I’ll create a constant based on the domain, to tell me which site we’re on. I can use that for all of my “old school” PHP-based site-specific stuff. Now I just need to find the function WordPress uses to tell which style variation the site is configured to use.

Except… uh… I really can’t seem to do that. I googled it. I used the dreadful search tool in the WordPress Developer Reference. I checked a few of the tutorial sites. Nothing.

I even poked around the WordPress source code. Still nothing.

Finally, I rationalized… well, it has to be storing that setting in the database, so I’ll just temporarily turn on the Site Editor, set my style variation, and then search the wp_options table of the database to see where it turned up, and then maybe I can reverse engineer from that.

Nope.

There’s nothing in the wp_options table.

Oh no, I thought. They aren’t putting this into the wp_posts table, are they?

Yes, and no.

Yes they are, but no, it’s not what I thought. It’s much, much worse. They’re copying the entire contents of the style variation’s JSON file into the table.

Ugh. I mean, I kind of get why they’re doing that… because you can make additional customizations directly in the Site Editor, and that “post” (eye roll emoji — yes I have the stupid built-in WordPress emoji functionality disabled via my No Nonsense plugin) is where those changes get stored. But, uh, wouldn’t it also make sense to store the name of the base style variation itself, in case the user wants to reset it? Maybe they do — somewhere — but I’m once again too demoralized by the seeming absurdity of this whole enterprise to try to track it down.

The big problem is, this means I can’t just hardcode a way for the two sites to load a style variation’s JSON instead of the base theme.json file. And since that file is &#%^!#ing JSON instead of PHP, I can’t put conditional logic directly in it.

I’m leaving this post here, with the situation unresolved at the moment, but my next avenue will be to see if I can find a place where I can shunt WordPress over to using my variation JSON files.

Yes, I am Doing It Wrong™. But if you ask me, the entire thing is doing it wrong.

And don’t call me Shirley.


Update: OK, like, ten seconds after I published this, I decided that the correct course of action is simply to, alas, scrap my idea of using global style variations, and go back to building two separate child themes, even though it will mean a lot of redundancy. Global style variations are a good idea, but they’re just not implemented in a way that is practical for me to use. (Which makes me wonder if the way they’re implemented is really practical for anyone to use, but once again I am clearly not the core team’s target audience.) Thank goodness I hadn’t yet emptied the trash on my Mac.

Elon’s Twitter finally does something right

I joined Twitter in 2009, and over the span of a decade amassed over 40,000 tweets (and just over 500 followers, most of whom I believe were real humans, as I actively culled the obvious bots during my Twitter heyday). But when, around 2015, the site became a platform for would-be fascist authoritarians, I began to lose interest. I pretty much left entirely in 2017, and after a brief re-emergence in 2019 (which only served to confirm that the place was a rage machine hellscape I was better off avoiding), I decided to delete my account entirely.

But for some reason, the Twitter of 2019 labeled my closed account as suspended — with their standard message about violating terms of use. Absolutely false. And while I was briefly outraged, I eventually saw it as a badge of honor. Twitter was an apocalyptic dumpster fire long before Elon Musk was forced to buy it, and I became almost proud to have people think I had been kicked out against my will.

Periodically over the past 3 1/2 years I’ve gone back and looked at my account page to see if it still said I had been suspended, which it did. Until now. I just checked it today, and at some point in the last month or two, since I last checked it, my account page has — finally? — been updated to the correct status: