Skip to content

Notes tagged “wordpress”

Completely overhauled—disclaimer: this version’s not live, yet!—Share on …

Completely overhauled—disclaimer: this version’s not live, yet!—Share on Mastodon’s “image alt text” functions. It’ll now always parse post content for images, and store each image’s alt (if any) attribute, and use that, regardless of what was stored—or not stored, courtesy of the “new” block editor—in wp_postmeta.

https://github.com/janboddez/share-on-mastodon/commit/917044f42790241e7be8d875c9ba7ea8d40b3c40

Realizing the way I typically set up WordPress …

Realizing the way I typically set up WordPress URLs (using a so-called permalink front that matches my “non-home” “blog page”) may not be all that great after all, as it affects, well, nearly all URLs. I work around that for IndieBlocks’ notes and likes, and it can be worked around even for author archives (through a filter). Except, e.g., the ActivityPub plugin doesn’t like filtered author URLs (because it needs them to never change).

Pushed v0.7.0 of IndieBlocks. I’ll write a little …

Pushed v0.7.0 of IndieBlocks. I’ll write a little something over on the IndieBlocks blog later this week. Main change is the (very basic) Location block, which will of very little use to … almost everybody. Plus smaller tweaks all over the codebase. Wrote a quick “tutorial,” too, on how I set up a simple, webmention-enabled microblog using nothing but WordPress core and IndieBlocks.

https://indieblocks.xyz, too, got hit by WordPress 6.2.1 breaking …

https://indieblocks.xyz, too, got hit by WordPress 6.2.1 breaking shortcodes in block theme templates. The “fix,” for me, was really easy: convert the offending Shortcode blocks to Template Parts (two clicks, literally). Of course, I use only two instances of the Shortcode block this way; I’d make them into dynamic, “theme” blocks, but really, it’s not worth it.

Bookmarked https://wptavern.com/podcast/76-alex-standiford-on-how-wordpress-and-the-fediverse-can-be-combined. Remains kinda cool to see Share …

Bookmarked https://wptavern.com/podcast/76-alex-standiford-on-how-wordpress-and-the-fediverse-can-be-combined.

Remains kinda cool to see Share on Mastodon mentioned in the wild. And the WordPress app’s limitations. I work around those by using Micropub, which does support CPTs, but it’s still a bit of a hack. In fact, I have set up IndieBlocks to recognize “Micropub post types” and add in the proper blocks—or rather IndieBlocks’ blocks.

I’m deprecating the share_on_mastodon_enabled hook in favor of …

I’m deprecating the share_on_mastodon_enabled hook in favor of the “new” Share Always option. (The one thing making me reconsider was that the latter did in fact support a second, poorly documented, $post_id argument, which could be used to, e.g., enable forced sharing only for certain post types. That said, don’t think anyone actually uses it.)

In reply to https://jan.boddez.net/articles/conditionally-display-innerblocks. Neat Gutenberg trick: you …

In reply to https://jan.boddez.net/articles/conditionally-display-innerblocks.

Neat Gutenberg trick: you can have a block accept (and store) InnerBlocks, yet still employ a server-side render callback in which you can run all sorts of logic before returning … the block’s “static” contents.

Works for things other than InnerBlocks, too, by the way.

The trick is $block->render( array( 'dynamic' => false ) ), which returns whatever was saved in the editor. And that can still contain dynamic content, by means of InnerBlocks.

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:

  1. 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.
  2. 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.