Named Alternates for WordPress


Screenshot of Lynx, the text browser, showing named alternates.

HTML documents have the concept of an alternate representation of the document. For example, a page's header might say: <link rel="alternate" type="application/rss+xml" href="https://shkspr.mobi/blog/feed"> That tells you there's an alternative representation of the page, what sort of content it is, and where it is located. That's nice. But it's hard for a browser to tell the […]

Continue reading →

link rel="alternate" type="text/plain"


The Logo for WordPress.

Hot on the heels of yesterday's post, I've now made all of this blog available in text-only mode. Simply append .txt to the URl of any page and you'll get back the contents in plain UTF-8 text. No formatting, no images (although you can see the alt text), no nothing! Front page https://shkspr.mobi/blog/.txt This blog […]

Continue reading →

A completely plaintext WordPress Theme


Screenshot showing my blog rendered just as text.

This is a silly idea. But it works. I saw Dan Q wondering about plaintext WordPress themes - so I made one. This is what this blog looks like using it: The Code You only need two files. An index.php and a style.css. The CSS file can be empty, but it needs to exist - […]

Continue reading →

WordPress GeSHi Highlighting for Markdown


The PHP logo.

I've launched a WordPress Plugin for an extremely niche use-case. WP GeSHi Highlight Redux works with WordPress's Classic Editor to convert Markdown to syntax highlighted code. That allows me to write: ```php $a = "Hello"; $b = 5 * 2; echo $a . str($b); ``` And have it displayed as: $a = "Hello"; $b = […]

Continue reading →

Server-Side Rendering of Embedded Markdown Code Snippets in WordPress


The Logo for WordPress.

Because I'm a grumpy old man, I don't use Gutenberg or Block themes on my WordPress. Instead, I write everything in Markdown. When I write code snippets in Markdown, they look like this: ```php $a = 1; echo $a; if ($a < 5) { // Do Something return thing( $a, true ); } ``` But […]

Continue reading →

3,000 blog posts!


The Logo for WordPress.

This is the 3,000th blog post I've published on this site! Bloody hell! I first started a blog on Blogger.com in 2004 - twenty years ago. Like all blogs, I managed half a dozen posts before I forgot about it. Cut to 2007 and I decided to launch shkspr.mobi as a weird site dedicated to […]

Continue reading →

A personal WordPress MonoRepo for my themes and plugins


The Logo for WordPress.

I use a self-built WordPress theme for this blog. I also use a variety of self-developed WordPress plugins for various enhancements. I used to publish these plugins, but I get terribly confused by the SVN shenanigans involved, and they weren't used by many people, so I stopped. Recently, I've been moving all my plugin code […]

Continue reading →

A library of all my book reviews


A grid of books with their titles and star ratings.

One of the things I love about having a database-backed blog like WordPress is that's it opens up a delightful range of possibilities for displaying content. I've read and reviewed around 300 books over the last few years. So I wrote a scrap of code which goes through all my book reviews, grabs their cover […]

Continue reading →

Publish Confirmation For WordPress Classic (2023)


Screenshot of a page asking for confirmation before publishing.

Here's a quick scrap of code that works. There are lots of outdated tutorials out there for old versions of WordPress. This one is tested to be working in WordPress 6.3.2. This will pop up a confirmation dialogue when you try to publish, update, or schedule a post or page. The Code Add this to […]

Continue reading →

Find WordPress featured images with no alt text


The Logo for WordPress.

WordPress allows you to set a featured image - called a "thumbnail" in the API. This gives a single image which can be used on a listing page, or shown when a post is shared on social media. The WordPress Media Library lets you set the alt text of an image. But, crucially, this alt […]

Continue reading →