Stupid CSS trick of the day: Make a list two-column only if it contains at least five items

I’m working on a new WordPress site that has long dropdown navigation menus. I wanted to make the dropdowns two-column, but only if there are at least five items in the submenu.

The two-column part is easy:

.sub-menu {
  column-count: 2;
}


I’ve (finally) been learning more about some of the “new” conditional selectors in modern CSS over the past year or so. It occurred to me that there might be a very easy way to do this, checking if the submenu has at least 5 items. But I wasn’t sure it would work, so… I tried it:

.submenu:has(.menu-item:nth-of-type(5n)) {
  column-count: 2;
}


Much to my delight, it works! Submenus with four or fewer items are displaying as a single column, and the ones with at least five are displaying as two columns.

Now, this of course is using CSS classes WordPress creates for its navigation menus, so if we were talking about barebones vanilla HTML5, you could use this:

ul:has(li:nth-of-type(5n)) {
  column-count: 2;
}


This also doesn’t really account for tertiary nested menus, but I only have this site set up to display two levels of depth on its nav menu.

In praise of link rot

Thanks to my On This Day plugin (not the plugin I was asking ChatGPT for help with in my last post), it’s really easy to “surface” (I hate that as a transitive verb) some really old posts here on my blog, which has now existed for about 24 years… frighteningly close to half of my life.

I clicked on the link to a post I wrote on this day in 2008. It was about links to articles I didn’t want to lose track of.

And it’s interesting for a couple of reasons. First, there was — was — an image at the top of the page. What it was, I have no idea. But that, like all of the other images on the blog before about a year ago, are now gone. I deleted them, because I was tired of getting harassed into paying hundreds of dollars out of the blue for random images that were lurking, unseen by anyone, on ancient blog posts no one reads.

I’ve usually been pretty good about only posting images I created, but when you’ve been at this for two decades, there are going to be a few times when you get lax. And there are a couple of news agencies who have contracted with a company that is absolutely ruthless about shaking down unsuspecting bloggers. What a racket.

But I digress… I wanted to talk about the links on that page.

They’re both dead, too, but they still go somewhere. The domains they linked to are still active, but now they redirect to 404 pages on completely different domains. Whoever owned those domains either sold them or let them lapse, and now they’re something completely different.

A lot of people want to fight “link rot.” But not me. I relish it. The Internet is an Orwellian memory hole, and fixing broken links in blog posts from 2008 just accelerates that. The pages I’m linking to have long since disappeared. But their URLs remain in a zombie state here on my blog as a testament to the fact that these things once existed.

Like the website Veer.com. I don’t even remember exactly what it was, and it had been years since I had last contemplated its existence, but once I saw that link, my immediate reaction was, “Oh yeah, I remember that site. Well… no, actually I don’t, but I remember that was a site, and I used to like checking it out semi-regularly.”

There are so many lost worlds like this. No longer present anywhere on the Internet*, but lingering in the dusty backrooms of Gen Xers’ minds.

*I lied, of course. The Wayback Machine exists. I managed to find a snapshot of that URL from June 10, 2008, about a week before I posted about it.

It even still has the image of the coffee mug I was interested in! But I’m not going to post it here. I know better. Finally.

I actually used ChatGPT to solve a coding problem today

The following originally appeared as a post on my YouTube channel.

Trigger warning: not entirely negative stuff about A.I.

I have the script written for the first half of my “5-String Bass Showdown” video (the second half will be unscripted), but I may not get around to making that video this weekend, because one half of my “day job” (indie WordPress plugin developer) is bleeding over into my video time.

I spent about 10 hours sitting in front of my computer today. The first half of that was beating my head against the wall over an extremely obscure problem I was having with Block Editor development. (I am an old school PHP developer and I have never bothered to learn React, so I keep the dev side of the Block Editor at arm’s length.)

Anyway… after literally 5 hours of almost no progress, beyond homing in on exactly where, but not what, the problem was, and getting nowhere reading 6-year-old GitHub discussion threads and even older StackOverflow threads, I finally resorted to…

Asking ChatGPT. (With DuckDuckGo’s Duck.ai as an intermediary, of course.)

Luckily I had gotten to the point where I could succinctly state in one sentence exactly where I was stuck, and provide ChatGPT with the relevant JavaScript function from my code.

In less than 5 seconds, it returned a cogent explanation of why my code was having an issue, along with a minimally rewritten version of my function that solved the problem.

It even mimicked my somewhat idiosyncratic coding style.

As Dr. Gnome would say, “Uff da.”

After finally taking a break around 3 PM to eat lunch and ponder my existential crisis, I decided to throw a few of my other “back burner” issues at it. The first one, which I thought would be the simplest, ended up being unresolvable. Two others were simple code refactoring (JavaScript is not my strongest suit), and it knocked those out of the park.

So… I’ve come to realize, A.I. like ChatGPT does have a role in my work. It can be a good partner to troubleshoot and optimize the code I write in languages I don’t know like the back of my hand.

But to that end, I think of it in a very similar way to how I’m using the stem splitter in Logic. It’s a tool to streamline the things I already do, and fill in the gaps. But ultimately I still have to be the one doing the thinking.

Thoughts on Doing Better

This is the script from a YouTube video I posted today.

These are not normal times. I can’t just do the same things I normally do, and pretend nothing is happening.

I. Freedom and Responsibility

I believe in the innate freedom of every person to choose how they want to live their lives. (And every person is a person, regardless of their race, religion, sexual orientation, gender expression, or ability.) I also believe that freedom comes with responsibility.

If we choose to live in a society — which is not really a choice in the 21st century — then we also have a responsibility to the others around us, to respect and defend their freedoms. The civil rights movement was born of the principle that no one is free, unless we all are free. Or, to put it another way: injustice anywhere is a threat to justice everywhere.

But it’s not just about individual freedoms. Working together, we can do things that none of us can do alone. Collective action allows us to create a better, more just, more meaningful world, for everyone.

II. Power and Money

The late, great senator from my home state of Minnesota, Paul Wellstone, famously said it best: “We all do better when we all do better.”

Or maybe you prefer the words of Jesus: “So in everything, do to others what you would have them do to you, for this sums up the Law and the Prophets.” (Matthew 7:12 [NIV])

Power and money are corrupting forces. Yes, complex organizations need some kind of hierarchy, to make decisions and maintain order, but everyone should still have a voice. And money is an essential tool for an economy to function, when we remember its fundamental purpose: storing the value of human effort, to facilitate trade.

But there are those among us who ignore the social contract; those who choose to hoard wealth and power. Their insatiable desire for more drives a wedge between us. Great empires of injustice are built on the backs of the masses, whose labor is essential to the construction of those empires, but who do not receive their fair share of the value they produce.

Every large-scale economic system, across the spectrum, from communist totalitarianism to laissez faire capitalism, creates an imbalance of wealth and power. It is the power of the people, the purpose of democracy, to provide a counterbalance, to ensure liberty and justice for all.

III. The Internet

The Internet exploded in the 1990s, at a unique time of international openness and realignment, following the collapse of the Soviet Union. There had never in human history been such a powerful tool for the free exchange of ideas, with anyone in the world, nor such an opportune moment for it to appear.

Fast forward to 2026, and obviously that utopian vision for the Internet has become severely corrupted by power and money… as almost all large-scale human endeavors inevitably do.

Today, misinformation and abuse are everywhere. Corporations have acquired, or squashed — often acquired in order to squash — many of the once-independent voices. Countries that were once exploring a new openness have slammed the door shut. Social media echo chambers encourage people to indulge their worst impulses. Every website seems to be drowning in ads and AI slop.

And yet, individual, self-hosted blogs still exist. Independent voices can still speak freely to the world on YouTube… even if the mysterious algorithm ultimately decides which voices rise to the surface in the vast ocean of “content.”

One word (OK, it’s a portmanteau/neologism) shows, better than any other, that the Internet can still live up to its earliest ideals: Wikipedia.

The Internet hasn’t completely lost its potential for the kind of collective action that allows us to do better — to create a more informed, more interesting, more just world — for everyone. But we have to work harder at it.

IV. Minneapolis

I live in Minneapolis. I love Minneapolis. It is a city that embraces the spirit of Paul Wellstone.

It’s not a perfect place. We all know that. But it’s a place that is trying hard to do better. And that’s made it a desirable place to be, for a lot of people.

A place that celebrates nature, with its award-winning park system. A place that celebrates the arts in their many forms, especially with its thriving theater and music scenes. A place that celebrates the diversity of its people, with a vast array of thriving restaurants and small businesses. A place that celebrates learning and innovation, with the University of Minnesota and numerous smaller colleges.

A place that is in jeopardy, in the present moment.

Minneapolis is a city of immigrants, built on stolen Dakota land.

I say that not because I believe it can somehow be “unstolen,” or as some kind of token white guilt self-flagellation. We live in the world we live in. We can’t erase the past — as much as some of us may try — but we can choose how we write the future. Choosing a future where we do better requires understanding how we got here in the first place.

People from all over the world choose to live in Minneapolis, because it is a place where they are welcome. Where they find opportunities. And where they become a part of the fabric of the community, making the city better for all of us by sharing their talents, their hard work, and the things that make their cultures unique. This is what the city has always been.

But, of course, Minneapolis is not perfect. No place is. Fort Snelling is a painful reminder of that, from its use as a concentration camp after the Dakota War of 1862, to the use of the nearby Whipple Building by ICE in 2026. (The Whipple Building is not part of Historic Fort Snelling, which is managed by the Minnesota Historical Society.)

Another painful reminder is the history of redlining, which still shapes the character of our neighborhoods more than a half century after the practice was banned. (The city has a program for homeowners to remove the now-unenforceable racial covenants from their property deeds, which my wife and I did in 2021.) And just six years ago, we experienced one of the most difficult times we’ve ever faced as a community, with the police murder of George Floyd.

But despite — maybe because of — our flawed history, and our imperfect present, we are always striving to make Minneapolis a place where “we all do better.”

The civic spirit of our city is a threat, to greed and corrupt power. So we’ve become a target. But our humble reputation for “Minnesota nice” belies the fierceness with which we will defend the things that make this place special.

That quote from Paul Wellstone, “we all do better when we all do better,” is not just an empty platitude. It’s a foundational pillar of the kind of progressive politics that has held strong here over the decades. And it’s something that those corrupted by wealth and power will never understand.

Here, we actually believe in something beyond ourselves. Our moral compass has not been skewed by the pull of avarice and cynical nihilism.

The thing is, we know we’re not especially unique in that regard. We believe most people, everywhere, feel the way we do. That everyone deserves a fair chance to live their own lives, and that they should treat their neighbors with care and respect. It’s just something that most of us go about quietly.

But. Now is the time to not be so quiet about it.

V. Do Better

These are not normal times… in Minneapolis, in the United States, in the world. I can’t just do the same things I normally do and pretend nothing is happening. I have to speak up. I have to do better.

I believe in the innate freedom of every person to choose how they want to live their lives. I also believe that freedom comes with responsibility. Individual freedom comes with the responsibility of helping to ensure and defend the individual freedom of others, and to engage meaningfully with others, to do the things we can’t do alone.

“We all do better when we all do better.”

But… what, exactly, does it mean to “do better?”

Is it a state of being? Or a call to action?

It’s both. And you can’t have one without the other.

How to get WordPress REST API self-requests working in a local development environment, i.e. Docker

I’ve only just started using Docker to run a local development environment for testing my WordPress plugin development. (Yeah, don’t get started. I’ve been working successfully for nearly 3 decades by testing my code on a remote development server.)

Using Docker is great! It’s so much faster to be able to just save my code and hit refresh to see the changes immediately, without having to sync the changes to the server… and local load times are lightning-fast!

But there’s a problem. ICS Calendar Pro‘s main functionality is to retrieve and process data from external URLs (specifically iCalendar subscription feeds), using the wp_remote_get() function. Once I added the ability to create and manage similar data locally, the obvious solution to me was to still retrieve and process that local data as if it were an external source, so ICS Calendar Pro generates ICS feeds for the internal event data, and then it makes wp_remote_get() requests to itself.

This was not working in Docker, and it took me several hours of wading through a sea of AI slop on the WordPress “how-to” websites that have spread across the web like a film of toxic algae, to finally find an answer.

Port forwarding.

I access the local Docker site at the URL http://localhost:8888 but it didn’t occur to me immediately that since Docker is running a virtualized Linux system inside a container, it’s Docker that is listening on port 8888 of my Mac system, but then Docker is routing those requests to Apache listening on port 80 inside the container.

Since the plugin’s REST API requests are coming from inside the container, Apache inside the container also needs to be listening on the port Docker is using outside the container.

This involved going into the file system of the container within Docker and editing the /etc/apache2/ports.conf file, to add the second line shown below:

Listen 80
Listen 8888

I restarted the container and boom! Everything was working.

Well… I think that’s because I had already taken another step that was probably essential for this. Since the WP REST API is using URLs with the wp-json/ path, WordPress’s URL routing needs to be activated. By default, the WordPress installation in the Docker container had the Permalink structure set to “Plain.” Changing that to anything else (on the Settings → Permalinks page) makes the REST URLs work.