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.

One thought on “WordUp Brighton – WordPress Gems for Devs by Milana Cap

  1. Pingback: HMRC mistakes and more, freelancers meet up on 4th September 2024 - Brighton Farm

Leave a Reply

Your email address will not be published. Required fields are marked *