So if I add a language-plaintext
class to a Code block’s code
element, to prevent highlight.js from highlighting it, WordPress’ block editor gives me the dreaded “unexpected or invalid content.” Only way out is to convert it to a Custom HTML block (which in this case is kind of okay).
Tag: code
-
Implementing `is_gutenberg()`
Share on Mastodon used to rely on (only) the transition_post_status hook to kick off a request to Mastodon’s API. Then Gutenberg came.
-
So if I add a language-plaintext class to …
-
Bookmarked Understand and use WordPress nonces properly – …
I love (slightly more technical) WordPress content like this! This one covers everything “nonces.”
-
I didn’t wanna deprecate IndieBlocks’ Context block nor …
I didn’t wanna deprecate IndieBlocks’ Context block nor introduce a bunch of breaking changes. So I simply added a couple new blocks (https://github.com/janboddez/indieblocks/tree/new-blocks/blocks). There’s two big differences:
- The new blocks support page title and author information (whereas a Context block will only ever show a bare URL), in a so-called h-cite microformat.
- They use, or support, Gutenberg’s
InnerBlocks
. This allows us to ditch sometimes unpredictable—as in, users don’t even know they’re there—block patterns.
Moved some common code into a global object thingy: https://github.com/janboddez/indieblocks/blob/new-blocks/assets/common.js. No clue if this is how it’s done, but it seems to work.
-
Must-Use Plugins
I have some eight so-called must-use plugins in my WordPress install’s “mu-plugins” folder, and use them as an alternative to “functions.php” (which is where most online guides still tell people to add custom bits of PHP).
-
Custom WordPress Archives
Rather than follow one of the many tutorials out there and use a custom page template and WP_Query, let’s look at rewrite rules and some “easy” filtering.
-
You Don’t Need an SMTP Plugin for WordPress
… and can use a built-in hook instead.
-
Prevent Jetpack From Displaying Geolocation Data
Jetpack, turns out, will append geolocation data—if present—to your posts.
-
Globally Set an Option in PHP
Here’s a pattern I was only vaguely aware of, until recently.
-
WordPress, Micropub and Featured Images
With Micropub image uploads working, I thought it’d be nice to just make the first uploaded image the Featured Image.