• Palia expansion dropping this week!

    Looks like the teased Elderwood Expansion is finally ready to launch. I’ve finished all the quests in the current game, so my play has dropped off for the past few months. I log in every now and then and work on levelling up my skills, but that’s about it. I look forward to seeing what’s in the new area!


  • Zucchini Bread

    I felt like baking today! I used a slightly larger loaf tin, so it’s a flatter loaf than usual. Still tasty though. (I actually like the crispy edges best.)

    Zucchini Bread


  • WordPress block theme issue – solved!

    WordPress block theme issue – solved!

    What a difference a day makes! Overnight a very kind person from cyberia/eu answered my Mastodon plea and gave me multiple ways to achieve my goal. They also confirmed that my problem with the custom shortcode approach is a current known bug in WordPress core.

    Since I already had the child theme set up, I followed their advice to use the new Block Bindings API. I made one small change in the callback function to check if the user is logged in before displaying the link. It works perfectly! No need for the Tampermonkey hack anymore. 🙂

    For the sake of posterity, here’s what I put in functions.php:

    <?php
    add_action( 'init', function() {
      register_block_bindings_source( 'webgoddess/edit-link', array(
        'label' => __( '[Edit]', 'webgoddess' ),
        'get_value_callback' => 'webgoddess_editlink_binding'
      ));
    });
    
    function webgoddess_editlink_binding() {
      if (is_user_logged_in () ) {
        return '<a href="' . get_edit_post_link($post->ID) . '">[Edit]</a>';
      } else {
        return;
    }
    ?>

    And here’s what I put in my template where I wanted the link to appear:

    <!-- wp:paragraph {"metadata":{"bindings":{"content":{"source":"webgoddess/edit-link"}}}} -->
    <p>[Edit]</p>
    <!-- /wp:paragraph -->

  • Links that have made me happy lately

    Clearing out a few more of my browser tabs…


  • Editing the WordPress Twenty Twenty-Five Theme

    Editing the WordPress Twenty Twenty-Five Theme

    Edited 11/05/2025: Solved thanks to a very kind person on Mastodon! Head here if you want to see the answer to my frustrations below.

    Or rather, trying to edit the theme and tearing my hair out for multiple hours… but I’m getting ahead of myself.

    I’ve been using WordPress for ten years now. I use it to run two sites with thousands and thousands of pages and posts. I’ve customised child themes. I’ve written my own functionality with PHP and WordPress shortcodes. What I’m trying to say is: I’ve got some experience. It’s not my day job, but I’m not an idiot.

    In 2018 WordPress introduced a new default editor called Gutenberg that was a much more visual, drag-and-drop interface. I hated it. Pretty much everybody hated it. I installed the Classic Editor plugin and never looked back.

    Last year after I quit my job I decided to devote a bit more time to my sites, especially this blog. I started with a visual refresh, and I decided to bite the bullet and use the very latest default theme – Twenty Twenty-Five. It’s a “block theme,” and it took me a while to get my head around making changes in the Site Editor rather than in a child theme. But making changes was fast, and I got the site mostly looking the way I wanted it. I was reasonably happy.

    This year I started a project to clean up my archives, which I call “tending my digital garden.” Every day I go to this page, which shows me all the posts for that calendar day going back 25 years. I scroll through them and look for stuff like broken links, missing tags and categories, malformed HTML. When I find one of them, I open it in the editor to fix it. This requires two clicks: 1) on the post title to open it in a new tab, and then 2) the “Edit Post” link in the admin toolbar. While this doesn’t seem like a lot, I’ve been doing it for hundreds of posts, every day since February. It adds up.

    On my previous theme (Twenty Sixteen), each post had a little “Edit” link that would appear if you were logged in. You can see an example on my Roald Dahl site, which still uses that theme. So why doesn’t Twenty Twenty-Five?!

    A screenshot from a post on RoaldDahlFans.com, showing an Edit link beneath a post

    Today I decided I’d had enough, and it was time to figure out how to add it in. Very quickly I found this page: How to Add an Edit Post Link to WordPress Posts and Pages. It’s clear that there’s an existing WordPress core function that does exactly what I need: edit_post_link. All I needed to do was figure out how to get that into my template, and it should just work, right? Except not.

    1. I’ve worked with child themes before, so I started by creating a child theme for Twenty Twenty-Five. To my surprise, when I switched over to it, I lost all formatting and styles on the site. All of those changes I made in the Site Editor are saved in the database and only apply to the parent theme, not the child. WTF THAT SUCKS. There was no way I was going to recreate all that work, and I didn’t fancy the idea of trying to edit the database directly to reassign the saved configuration to a new theme. Let’s try the other option.
    2. I installed the WP Code plugin and found that it already has a built-in snippet that consists solely of edit_post_link. Perfect. You have two options of how to insert it: you can have it automatically appear at designated spots (like before or after a post excerpt), or you can use it as a shortcode.
      1. I started with the automatic locations. No matter which option I selected, the Edit link would either not appear or appear at the very top of the site (i.e. not attached to the post). It seems like however the plugin is determining the location just doesn’t work with the Twenty Twenty-Five theme.
      2. I switched over to the shortcode approach and added the shortcode to my template (using the Site Editor and the Shortcode block) below each post in the loop on the Archive page. When I viewed it, it looked like it worked! Every post had an Edit link at the bottom. However, I noticed quickly that all of them had the same postID, the very first one in the loop. It was clear that the context of the current post was not being picked up. That’s fine; I saw in the documentation that that you can supply a post ID to edit_post_link. Folks, I tried multiple different ways of getting the post ID in there and nothing worked. So this method was a bust.
    3. I went back to the child theme. I found a plugin called Create Block Theme that would clone your current theme AND all your Site Editor changes into a new child theme. I tried it out and it worked perfectly! I now had a child theme of Twenty Twenty-Five and could make changes directly to the templates in the code. Great. I connected to my host and started looking at the files… and for the life of me, I could not figure out where the hell to actually make my change. Block themes seem to use HTML files as well as PHP. I tried editing template PHP files; I tried adding things to functions.php. I just could not get it to work.

    I asked Mastodon for help. I mostly got replies from people who misunderstood what I was trying to do or thought I was an idiot who couldn’t see the “Edit post” link in the toolbar. 🙄

    Time for the nuclear option – I got Rodd and walked him through the problem, which meant painstakingly taking him through every bit of research I’d done and which options I’d tried and showing him how they didn’t work. He had some more ideas that we tried – including making a custom block type – but every approach either didn’t work or was way complicated for something that should be EASY. In fact, it should be BUILT-IN. Why the hell isn’t it included in this theme?!

    In desperation I thought about doing it on the frontend. Maybe I could write some Javascript that would scrape the links on the post and… DUH, TAMPERMONKEY. I installed it and got it set up, and then pulled in Rodd for his superior DOM manipulation skills. Here’s our quick and dirty solution:

    (function() {
       'use strict';
    
       document.querySelectorAll('.wp-block-post-date').forEach((el)=>{
          const a = document.createElement('a')
          a.href = '/wp-admin/post.php?action=edit&classic-editor&post=' + /archive[/](\d+)/.exec(el.querySelector('a').getAttribute('href'))[1]
          a.appendChild(document.createTextNode(' [Edit]'))
          el.appendChild(a)
       })
    })();
    

    Rodd thinks there are probably more elegant ways to do this, but it works. We look for posts with dates that contain a link, pull out the post ID with a regular expression, and add in a new appropriate “[Edit]” link. It works great, and it’s going to make my daily blog cleanup a lot faster!

    A screenshot of web-goddess.org showing an [Edit] link next to the post date

    If you know of how to edit the Twenty Twenty-Five child theme to include this, please let me know as I’d love to know how it’s actually meant to be done…


  • I don’t have spotify

    Super useful “translator” for Spotify links to open in other music players. (Last November I cancelled my Spotify subscription and switched to Apple Music.) Seems to work fairly well on generic things like albums and artists, though obviously not for playlists that are only available on Spotify. (Link courtesy of kottke.)


  • Library events

    As luck would have it, I’m booked in for several interesting library and literacy-related events here in Sydney later this month:

    Let me know if you’re going to any of these!


  • Buttered, Chippendale

    A woman in glasses in front of a bakery counter

    I saw on my RSS feed last week that a new trendy Korean bakery called Buttered was opening soon at the Central Park brewery development. This morning I saw a review on Not Quite Nigella that tipped me off that it had soft-launched. What better excuse for an afternoon walk to check it out?

    A man peers through a window into an empty bakery kitchen

    It was a Thursday afternoon, and the place was fairly empty. I didn’t see any of the viral tissue bread, but they still had a selection of their “SaltyBoi” salt breads. We picked up a plain and a corn cheese to go, opting to heat them up in the oven at home.

    A plain salt bread, which looks like a fat croissant crossed with a dinner roll

    Rodd opted for the plain salt bread, which looks like a croissant crossed with a dinner roll. It was very buttery, so buttery that he decided to take a Lactaid after the first bite.

    A view inside a salt bread, showing a hole where the butter melted

    Inside was a hole which must have been where the butter sat before it melted. He found it very tasty and thought it would make a great breakfast roll.

    A corn cheese salt bread, which is a football shaped bread roll split down the middle and filled with melted cheese and sweetcorn

    On the basis of the NQN recommendation, I went with the corn cheese salt bread. I’ve had corn cheese at Korean restaurants before and figured I’d like this.

    A half-eaten corn cheese salt bread, showing an interior filled with melted cheese and sweet corn

    It was wonderful! I’m a person that loves a crispy/chewy bread crust, so these SaltyBois are perfect. They have loads of crunch but don’t shatter everywhere like a croissant. The inside was soft and loaded with gooey sweet corn cheese. Really yummy.

    Buttered definitely seems like it’s worth another visit. We’ll have to go back and get the tissue bread one of these days…


  • Mi goreng

    While I was away, the Snook decided to level up his mi goreng. All the plastic packets in the prepackaged version bothered him, so he bought all the components to make it from scratch: kecap manis, chili crisp, sambal badjak, Maggi seasoning, sesame oil, chicken stock powder, plain noodles, and fried shallots. He just made it for our lunch garnished with prawns, peas, green onions, and a fried egg. 😍

    Mi goreng



ABOUT

My name is Kris. I’ve been blogging since the 90’s. I live in Sydney, Australia, and I spent most of my career in the tech industry.

No AI used in writing this blog, ever. 100% human-generated.


search


CURRENTLY LISTENING


CURRENTLY READING


LATEST COMMENTS

  1. Woot, my knee-jerk don’t-overthink-it pub-quiz answer was Iran which seems to be [✓]. I ‘knew’ it was more populous than…

  2. My home economics teacher taught us to use “J cloths” as press cloths. (Cellulose cleaning cloths). The upside of using…


BLOG ROLL


STAY CONNECTED


Special thanks to Matt Hinrichs for the site logo!