Monthly Archives: September 2024

WordUp Brighton – WordPress Gems for Devs by Milana Cap

Last Tuesday I attended the WordUp Brighton WordPress meet up in Freedom Works Brighton. They had a talk from Milana Cap, a very active WordPress developer, covering recent additions to WordPress that developers may not know about. Milana streamed the talk from her home in Serbia and a copy of the talk is up on the Silicon Brighton YouTube channel.

WP HTML Tag Processor

First we were shown an example of using WP HTML Tag Processor, which lets you easily parse HTML within WordPress.

Milana used an example of spotting and removing “nofollow” from internal links which were to versions of the domain that didn’t match the set domain of the WordPress site. This was quite useful as it allowed her to show us a way the code could help in quickly parsing and changing some of the content of blog posts, but it was also a bit distracting as it’s the sort of problem I’d personally fix via updates to the database once, rather than having to run a fix every time a page loads, and that kept tripping me up while I was trying to think of ways I’d actually use HTML Tag Processor within the projects I do.

WP HTML Tag Processor looks like it could be useful and reminds me of Simple HTML DOM, a more general PHP HTML parser that I’ve used in a few projects in the past.

Interactivity API

The bulk of the talk was showing us ways to use the WordPress Interactivity API.

As I now understand it, this allows you to write PHP code within the WordPress block system and the API then builds/accesses various Preact Javascript code to do the interactivity part that you want. So, it sets up AJAX calls, shares data around, and live updates the page, all for you from quite a small amount of PHP. Milana built a simple example of this for us, and kindly linked out to some other examples from the documentation she’d put together for the talk.

I think this is potentially going to be very, very helpful for when I’m building interactive elements within a WordPress project as it’ll save me the time of writing Javascript code to handle AJAX, and API endpoints, by having all that code created by WordPress itself. It’s going to be very interesting to explore what the Interactivity API can do to help add small things to a project, e.g. search autocomplete, something I put in quite often but can be a bit of a faff to add.

Hopefully, the Interactivity API will catch on, which will make long term maintenance of sites and plugins more straightforward as they can use this within WordPress, rather than a site having multiple versions of jQuery, Vue or whatever.

Learning from learning

For me, watching live coding after a long day working on client projects was difficult. It did show us how little code needs to be written to get useful activity on the page, but I’d honestly have been fine with being shown a pre-built version and talked through what it was doing. By the end of the talk I was a bit torpid as I tried to process what we’d seen and come up with uses for it, and couldn’t think of any questions to ask, even though this is a really interesting feature that I hadn’t heard about.

I don’t mean this as a criticism of Milana, she was giving up her evening to present the talk to us and that was fantastic of her. This is a note to myself that if I’m going to an evening talk, I need to balance out what I’m doing during the day so I’ve enough mental energy to really process what I’m watching. I’ve got notes, but being able to understand more about what was going on with the code as I was watching would have been helpful.

Thanks

Big thanks to Milana for showing us these features, both of which I knew nothing about and could have missed out on using, and thanks to Paul Bunkham and Sim Brody for organising WordUp Brighton.

My UK freelancer forum on Reddit hits 6,000 members

I run a small “sub-Reddit,” a community within the site Reddit, for UK freelancers. Today I noticed it had hit 6,000 subscribers, which is a nice big, round number.

When I agreed to help moderate the community, there were 53 subscribers. That was back in September 2013, so growth hasn’t been massive or quick, but I also haven’t put a great deal of effort into it, so I think that’s absolutely fine.

Screenshot of Reddit showing the old interface and the area freelanceuk, which is at 6,000 subscribers

History

Originally, I responded to the previous moderator who was asking for help as I didn’t want the “sub” (subsection of Reddit, basically a forum) to die off. It turned out he wanted to leave moderation of it entirely, but the tasks were not onerous so I kept it up. I thought it would be a useful place to get inspiration for help pages for the Farm’s website. I haven’t done too much of that, but writing this did prompt me to request a file of all of my Reddit contributions so I can extract the useful bits more easily than trawling through my comments on Reddit itself.

Reddit as a place to be

To be honest, I don’t like Reddit much any more. Like any very large forum-style site on the web, it has a large share of absolute bellends difficult people with offensive views, which in the past the site management did very little to control, but it also had pockets of loveliness and the sub-section for talking about written science fiction particularly filled a hole for me left when Usenet became harder to access, and has managed to stay decent for many years. But the Reddit management has been making choices I’d rather they didn’t for a long time, most recently stopping free API access for mobile apps and making that access extremely expensive to force everyone to use their own apps, and now selling everything people contribute to Google for their use training their LLM (AI) project.

Long term I’d like to move off Reddit, but I haven’t had time to set up an alternative, and I know it will get less use. FreelanceUK has added about 2,000 members in the last year and a half. That’s because Reddit is a very popular site. Moving off to my own space will not get that sort of traction without a hell of a lot of effort, I’ve got it on Reddit just by removing some junk posts and answering questions that I can answer.

Running and growing a small sub-Reddit

The running part is quite easy as this is a niche interest so there isn’t a lot of spam or heated arguments, it comes down to:

  • Have some clear rules about what can be submitted
  • Check all submissions, ban people who submit spam the first time they submit it. Warn people who post borderline stuff but are probably a bit clueless in a comment, and remove their post which takes it out of view
  • If people end up arguing with each other, step in and suggest they just leave it as they’re not convincing each other, mark your own post as a moderator so they take the advice seriously. Almost always, they’ll stop. Sometimes, they even apologise to each other (this may be a British trait.)
  • Don’t get angry when people don’t like what you post yourself

On this last point – I occasionally submit links to what I think is an interesting article or tool. Often these get downvoted. It really doesn’t matter. People’s reasons for downvoting are myriad, don’t let it get to you.

I use an RSS Reader on my phone to check for new submissions to FreelanceUK. That lets me catch and remove spam pretty early, and that helps keep the forum professional looking. Spam breeds spam, so it’s best to get rid early. I find it very difficult to use the mobile version of Reddit to ban spammers, so often it’s a case where I’ll remove their post, then ban them when I’m next on my computer. Banning only stops them posting to my little area of Reddit, they’re free to use the rest of the site as usual.

Growth is harder. I have found people respond best to posts on Reddit itself. They don’t want to follow a link to somewhere else, they want to consume right where they are, and I think social media is the same way – people would rather read a screenshot of something within the site/app they’re using rather than click through to somewhere else where it would be easier to read.

I’ve made some posts on Reddit of content I’ve written for this blog or the Farm website, but mainly what I’ve done is answer questions. If someone has a question about freelancing that I can answer, I do so. Now the forum is bigger, if I’m busy I’ll leave it for a while and often a member will give a good answer and I won’t have to, but if it’s been a long time, like a day or two, and no one has answered, I will find the time.

I will upvote people’s questions and the good answers, even if it means Reddit will boost their answer over mine. The “karma” system of points within Reddit doesn’t really mean anything, but we are all distractible chimps at heart and it doesn’t cost anything for me to give people a little boost in their day by seeing someone appreciated their comment.

That’s basically it – keep things civil and on topic, be helpful. It means growth is slow, but I can keep it going without much effort and it can be a helpful place to people. I don’t need it to be more than that. A small, low maintenance project that helps people doesn’t need to become something bigger or “better,” it can just be what it is.