Wordpress and htmx: A conversation with developer Andrew Rhyand

Lazarus:

So I've asked a few times what people are most interested in hearing about, with, you know, on on this podcast and about HTMX. And, you know, people want to hear different things, lots of ideas, but one of the things that keeps coming back is integrating HTMX with different platforms. You know, everybody has their own platform and they're all people are wondering, okay. What if I want to use h t m x with this? How would I do it with this?

Lazarus:

And I was recently talking to, a developer who posted something very a really cool h t m x demo sort of site on Twitter. His name is Andrew Ryand. And I reached out to him and was kind of just curious what sort of projects he was working on. And he is primarily working in the WordPress, world for the day job. And I just thought that was was interesting.

Lazarus:

I asked him if he would be willing to to join to talk about that a little bit on the podcast. So so I'm gonna give him a call and ask, and just to chat a little bit about, his experience using WordPress and HTMX. Hey, Andrew. Hello? Yep.

Andrew:

Yeah. Couldn't hear you, but, cell phone technologies. Okay. Yeah.

Lazarus:

Yeah. Can you hear me?

Andrew:

I can. Yeah. I can hear you now.

Lazarus:

Alright. Excellent. Yep. Cool. So, yeah.

Lazarus:

I don't know. You wanna you wanna talk some WordPress?

Andrew:

Do you wanna talk some WordPress? Yes. My, the bane of my developer existence. I don't have a lot I don't have a lot of kind words. No.

Andrew:

I I can't but it's it's, you know, it's and that's the reality, though, right, kind of of of some software development is, you know, you work with things that, you don't have control over. But, but no, I I do have some. I I I said I I have I have had happy moments in in the ecosystem, and and, we do end up building some pretty neat things with it. And it it is clichely the right tool for the job sometimes. Right?

Andrew:

So,

Lazarus:

Yeah. And I don't wanna get you in trouble at work either. You know?

Andrew:

Oh, I don't. I don't. I don't care. I mean, it's not it's not true. Yeah.

Andrew:

I mean, you know, it's it's I I these are these are conversations that I have, actively at work. So I'm not I'm not too, you know, I I definitely don't I don't sit there as the, the curmudgeon in the corners and and rant all day, but but I do have opinions. And, yeah, because some of these other tools, like, that my passion and I I believe you agree with is, like, Laravel and these type of things. So I do get to use them, on occasion. For sure, my own stuff.

Andrew:

But, yeah. So I'm I'm not too I'm not too worried. It won't be a it won't be a dunk fest on on, any particular tool. But,

Lazarus:

Yeah. So maybe maybe, if you don't mind, maybe we can start with, just your sort of general background, like how you got into development and tech and and that kind of stuff.

Andrew:

Yeah. Yeah. You bet. About 12. 12 years ago, kinda did the math this morning.

Andrew:

I I made the transition from, the glorious retail sales life and went into tech, but tech was not I didn't reach for tech specifically. I was living in North Carolina at the time and, I was watching, there's a HGTV show called House Hunters. And Yep. You know, it's about I know that one. It's about an agent showing folks houses and then trying to sell them and then they get to pick the one of the 3 and all that.

Andrew:

But I noticed that while I enjoyed the house, the real estate part of it, I I noticed every now and then, they would always be like, well, I can work from anywhere. I just have a laptop. And at the time, I was I was unaware what what that meant and and, like, great. Sounds good. I know it's not the point of the show, but what are you doing on the laptop?

Andrew:

Right? And I know there's a lot of stories there. So I call, you know, I I I was living near Duke and I, you know, called Duke and I was like, yeah. Like, what are you interested in enrolling in? I was like, anything that I could work on a laptop, you know, and I just kind of at least explore what that means.

Andrew:

I kind of I kind of romanticize, like, a lot of folks do that. Now sitting on the beach working on laptop. Turns out terrible to sit on the beach and just bake on in front of the screen. But Yeah.

Lazarus:

The beach beach laptop is way overrated. Boy. The light is terrible and you might destroy your laptop.

Andrew:

Yeah. It's it's terrible. So but I still like the idea of of of, sitting with the dog on the couch is what you what I which I do often now. But so, yeah. Yeah.

Lazarus:

There there we go.

Andrew:

Yeah. So, you know, that was it. That was kind of my motivation. So I was like, I just wanna do that. And then it turns out there's some options and one of those options is becoming a developer or at least building things.

Andrew:

And that's kind of where I started. I think I definitely didn't you know, think about code. You know, WordPress was an easy launching point for that. I could you could you could easily spin up with premade themes and these type things, and I was able to get, you know, some live.com up and running, which is very rewarding. But then, ultimately, I think most people, that have the site you you pre made that you bought doesn't quite do exactly what you want it to do.

Andrew:

So you you go down the rabbit hole of finding what a file looks like and what what's this all about? And what's a database? And this looks like a spreadsheet and all that.

Lazarus:

Not not everyone goes down that rabbit hole. So Data it's like gotta have you gotta have some certain interest or something that, like, since because there's a lot of things I would not go down the rabbit hole for, but this is the sort of thing that some people have that that pull towards it.

Andrew:

That that's right. And I yeah. So once and then and then the bug bit me. As soon as I started doing that, I I I was like, this is that part of the brand that you need to satisfy and tickle this that problem solving part. Again, some have, don't have.

Andrew:

But I have and, that was it. And so started to, build websites. I didn't do any agency work or employment. I was I was all of my own products and and projects and, wow. And for

Lazarus:

Did you start with a class? Like did would you would you learn in a class first or was it kind of just like diving in and just learning on your own?

Andrew:

Definitely self taught. You know, I mean, there's gonna be the online courses where wasn't as many back then. YouTube's got me a long way, but documentation, diving, and, absolutely a 100% self taught. And I definitely was still very much interested in having online stores and businesses and things to monetize. I wasn't terribly interested in client work at the time.

Andrew:

And so I would I'd have a saying, so I was building something and then learning at a pace that I just enough at that point in time to get the thing done. I had to put both hats on and, and that was great. I mean, I did that for many years, probably the first 8 years and then 4 years ago

Lazarus:

And this is all, like, on the side of

Andrew:

Yeah. Of Yeah. I know like

Lazarus:

a another job that you're doing?

Andrew:

I was still I was still doing, retail. I and so it was yeah. This is this is the the typical kinda, like, midnight oil burning, and you just kind of make it work and, Yep. But then yeah. So it was just great.

Andrew:

I mean, I had few projects, sold them off, and, but then yeah. Then for some reason, I'm not sure what what changed in my mind. I decided to kind of go out there and job hunt a little bit. And, yeah, for the last 4 years, I've been been working for a a small small, company, you know, 10 to 15 people, up in Missoula, Montana. I'm based out of Albuquerque, but

Lazarus:

Oh, Missoula. Yep. Nice.

Andrew:

Yeah. Very, very, very neat place. Yeah. That's that was my my journey

Lazarus:

in. Yeah. So so what do you what type of things, like, for your day job, like, what kind of projects are you actually working on day to day?

Andrew:

We definitely have because

Lazarus:

If you can say.

Andrew:

I can. Yeah. I mean, they're definitely gonna be they're gonna be they're gonna be websites, You know? And I and I say that in maybe, like, a contrast to, like, the the web app debate. Right?

Andrew:

What's the difference in those 2 those 2 type of things? But absolutely, it's definitely a mix of, usually have 1, maybe 2 kind of brand new green projects, that we're working on. Typically, those are gonna be kind of in the WordPress the WordPress space. But those are completely ground up builds where, you know, building custom themes from scratch and and and maybe some custom plug ins that may not exist in the existing space that we need to kinda build. But I'll usually you know, with our company being a pretty pretty small outfit, you typically take ownership of the whole thing.

Andrew:

It's usually just collaborating collaborating with a designer and take that Figma board and turn it into kind of a living, breathing website. Usually, kind of brochure style. I mean, maybe brochure plus because there's gonna be some some definite functionality and and some complicated feature bits, built into those. But Are

Lazarus:

they, like, usually selling products through the site or is it mostly kinda like this is, you know, they sell the products at their real store, but they need a website to, you know, show what's gonna be there kinda thing.

Andrew:

Yeah. So, you know, usually, I don't know if I've ever had kind of that that that presentation layer where they still have a brick and mortar. I mean, so if we're building ecommerce site, usually, that's because the ecommerce part is is gonna be their kind of their main their main profit avenue. So we'll definitely do kind of the e commerce stuff as well. But a lot of them, working with with 2 well, it was long term one, but they're just cancer organizations and bringing awareness and yeah, you know, in these kind of groups.

Andrew:

And so it could be that the subject the the the type of side and kind of what their business need is is all over the place. Right? All Firefighter Associations will have, we did a really neat project for a group that is, you know, interested in kind of, helping out the, kind of, Rocky Mountain wolves and and maybe kind of stop some of the, the hunting and the type thing. So, you know, sometimes, yeah, they're all over the place of what they have. But I think where my, the common through line for that is the ecommerce or ecommerce, they they do sell the stuff there.

Andrew:

But these other sites, they're typically, again, they're presentational. Right? There's the about us, our history, these type of pages. So

Lazarus:

Yeah.

Andrew:

Not a lot of that web app with exception, and then I think that's where the compelling part of something like HTMX comes into play. When there is this that roll up your sleeves and you've gotta you've gotta leave the WordPress model and kind of get into, like, this page is gonna require some dynamic, quiz or some dynamic multi, you know, field search form or something where it's it's a little bit more, I don't know, I'm going to say interesting type of work, but yeah. So we will do that kind of stuff. And

Lazarus:

then- Yeah.

Andrew:

That's kind of the great stuff. And then we will have clients with it just have problems and bugs, and I'll see Laravel projects every now and then, Python stuff that will kind of, like, dive into, React apps and and things like that. But we're typically not ground up building these type of things with rare rare exception. This this clients don't need that stuff, but we will I will work on that stuff from a from a, like, backlog, bug task on top of the evergreen stuff.

Lazarus:

Yeah. So so maybe it's actually worth just for my own purposes, but also, you know, if people aren't that familiar with WordPress because so maybe just worth stepping back a little bit about WordPress because so so I'll just say, like, my understanding, and you can, like, correct me or add to it. So I think of WordPress, like, first of all, it's a gigantic factor on the Internet. Right? I mean, it's, I don't know.

Lazarus:

I used to see stats it was, like, 60% or 70% of all websites on the planet use that's probably exaggerating, but there's some massive usage of WordPress, and and it was one of the reasons that PHP itself is such a huge language language online because if anytime you're looking at a WordPress site you're looking at a PHP site. So it's all written in PHP, and the overall purpose of it is to it's a it's a CMS, like a content management system. The concept as I understand it is you want to kind of empower, you know, first of all you want to have a bunch of defaults when you just need to do the same create the same sort of websites over and over, so you have a bunch of templates, and defaults, and plugins for different experiences, but you also want to empower the people who own the site to be able to modify a lot of the content. And does that does that all sound pretty correct so far?

Andrew:

Yeah. Yeah. You bet. I mean, that's that's exactly I mean, you know, at the end of the day is it start off with a blog? Sure.

Andrew:

Can you do an l have people built LMSs with it? You bet. Ecommerce sites. Right? It has it is expanded.

Andrew:

But at at its core, CMS is a 100% it. Right? It gives, I'm oversimplifying and and but like, yeah, it gives the end user, the client, the the non tech savvy or even the non developer person a place to to modify their website through a through an admin panel with with form fields and and places to edit, and that reflects kind of on the front end. So that's absolutely, I don't have an unbelievable Well, I don't know why its popularity was as why it ended up being. And your numbers weren't far off.

Andrew:

It's always a moving number, but I think it's in the 40 percentile of, like, sites that run Yeah. On on workflow. So it's it's definitely up there. But that is

Lazarus:

Which is unreal. I mean, that's huge.

Andrew:

It doesn't right. Yeah. Yeah. Lot of employment opportunities for that reason right there. Right?

Andrew:

You have something that has that consumes 40% of the web. So, but it it is it is it is absolutely kind of like a CMS. It it, I mean, I think you got it right. The thing I think that would probably be worth what made it a a wee bit different and I think where it it really kind of gained traction is is is not necessarily its its core functionality even though it's it's it's a pretty great admin panel. I think it's it's set up pretty pretty nice out of the box whenever you kind of just do, like, a vanilla install.

Andrew:

But the plug in, the ecosystem that that began around it is what is what makes it I think what kept it going and made it kind of popular and then also, I I do feel this way a little bit. What kind of vendor locks a lot of, especially agencies in these type of places that rely on it and use it as their primary tool for, you know, delivering websites to client work, at least in that field. So it's just so robust that plug in ecosystem allows you to do things very quickly and and spin up a lot of really interesting solutions pretty pretty quickly, for a lot of use cases for clients.

Lazarus:

So the plug in system, I I almost the way I've kind of understood it, it almost feels like it's like the app. Like it's its own ecosystem. It's its own market. So there are people you can create these plugins and then sell them within their ecosystem as, like, subscriptions or one time payments and and all this kind of stuff. So there's this whole world of almost like the app store of of these different add ons and plugins, that some people's job is just to build and sell those.

Lazarus:

Is that that's is that right?

Andrew:

That is I mean, that is, to me, outside of the core functionality of, like, WordPress and it's it's it's blogging days, that is what's made it what it is and absolutely big business. I mean, it's I think I threw down this notes that it's like the NPM or composer install for a a kind of a vanilla WordPress project. But you're at you're accurate your description is actually much better because not only is it a way to extend functionality and features, it is absolutely a gigantic, business. Right? So people selling yeah.

Andrew:

Members you know, extending it to be a membership platform or extending it to be I mean, ecommerce is the doors are wide open. The most you know, the the defacto ecommerce shop is is, WooCommerce, which is the plugin. And, you know, like most things, it gives you quite a bit of features and functionality, but the the secondary market for extending that to have subscriptions on top of that, or a calendar picker, or these type of apps like you described, right, is gigantic. I think that's why it still becomes popular and because people have been building these, add ons and plugins for, the better part of it's almost 20 years now how old WordPress is. It's I think it's up there.

Andrew:

And it's Yeah. Yep. Yep. So you have a lot of, there's a lot to choose from and that that it draws people in.

Lazarus:

So this is, I think, you know, one of the reasons I kind of wanted to ask about this and to talk about HTMLX and WordPress together. We had a conversation before and you mentioned that you had try you know, you had started using HTMX a little bit, and and part of the draw was that you know, I've said this on on the podcast before, and and it's something that you mentioned is, like, it's It is easy to incorporate HTMX with pretty much anything, you know, older technologies, and and I've said sort of legacy sites, but, you know, WordPress is not a legacy site. It could be. There could be old versions of WordPress, but there's something exciting about that to me of that being able to look back. It's maybe even some of these older WordPress builds, and then still be able to bring this kind of HTMLX, this new stuff into it.

Lazarus:

So have you sort of you've sort of started doing some of that? You sort of started looking into to adding HTMLX to WordPress?

Andrew:

I have. Yeah. So I yeah. I I use there is not again, it's assuming that the website, does not need such functionality, but I haven't had a new project or a project where I've had to, you know, extend a a client's old website with some kind of modern functionality. I have every single one of them has HTMLX installed on it in one way or another.

Andrew:

Right. And I the And I think that is the integration part. And it's such a hard conversation to have because it's you can't There's no magic words that I have ever come up with to describe to somebody how easy it is to integrate into anything. And and more importantly than ease, it's like that or is that that I don't know. You feel like a weight lifted off.

Andrew:

It's it's fresh air. Like, you're not fighting the thing. You can you can do it and that doesn't and that that that's like that's abstract. How how the hell do you communicate to somebody, right? How do you tell them that's and and what that means.

Andrew:

And and the the old argument, you know, use the thing and you'll you'll discover right tailwind. You scoff at it. You use it. Oh, that's actually not too bad. So but yeah, the integration I think is the interesting part because again, my my interest, I I have I have other interest of of kind of more interesting software development beyond WordPress.

Andrew:

So what I do is I have a running joke at work where I have, Will it WordPress? And it's integrating either existing tools into the ecosystem or, creating my own tools. An example, and I definitely borrowed gigantically from the Laravel ecosystem because again, that would be my passion. But, inertia JS, which is a popular, protocol library for gluing a back end, like a Laravel and and still using Laravel's router and authentication system and and sessions and these type of things that Laravel is very, very good at. And it marries it and kinda ties it together with front end tools like a Vue.

Andrew:

Js or React. Js. And so because it's a protocol, I I built the unofficial WordPress, Inertia adapter so that I could use, you know, inertia at at work on on a WordPress site. Same yeah. LiveWire, I I yeah.

Andrew:

Extended Livewire to, kind of

Lazarus:

not not No shit.

Andrew:

Not Livewire. I think I take that. I extended Alpine JS. This was a bad idea, by the way, and I I don't I don't. But, you know, I built the thing

Lazarus:

one way to find out.

Andrew:

It is. It is. But this is this is how this is how, like, you know, desperate, I guess, I was to kind of do it. And and again, there there are niceties and and the the the the user experience is very is great. But and I say it's a bad idea only because h tmx is is the is the better hammer.

Andrew:

But yeah. So I mean, I definitely created like a an expanded Alpine JS to make a quasi Laravel LiveWire component thing and and But those integrations, to answer that or go back to what integration was, are a little bit of a pain in the butt, right? And for sure, if anything, they're just this another package, right? And that package, even if I'm the maintainer of it, is still like there's a lot of moving parts and you've gotta to you gotta play nice with WordPress and then you've gotta know WordPress and, you know, if there are

Lazarus:

You gotta have the right PHP version You got right. For a lot of that stuff?

Andrew:

Absolutely. So you have to you they they are they are very Tech debt. So where the HTMX integration is is unbelievable, right? And it's easy to imagine an ever like a brand new green project. You could imagine that almost any tool would probably be okay because you're choosing from a blank file and deciding.

Andrew:

But where I found it to be unbelievable is I'll I'll go to a code base from some theme that myself or our AGC didn't build and it's, you know, a decade old and, you know, p if you know PHP, it's, it's not the templating is this unbelievably nested conditionals and it's, you know, it's not even it's not even using it's echoing divs and concatenating divs and concatenating LIs and Yeah. Is that right?

Lazarus:

It's not Blade. It's not Laravel Blade or one of these templating languages. Yeah. You're talking like straight echoing PHP.

Andrew:

It's how you you would template like a PHP, like 5 4 and before. So but so you can't really you don't want to touch the thing. And so the story normally is how a client I I have a maybe, like, a concrete example, but a client had this and and only what what they were doing is they had a, a list of, partner companies that they wanted to display and and they were displayed on the website. It's been that way for a very long time. But they wanted to add a a form with multiple drop downs and filters, right, to kind of filter through this list of potentially 100 of of these partner companies.

Andrew:

And, normally, yeah, if I was gonna do any of my other integrations or even kinda just, roll up my sleeves and tackle this on a one off project, I would have to reason about how that template's being output. I would have to do a whole bunch of things to there's a lot I have to rewrite because Yeah. It wasn't set up to handle some sort of, you know, dynamic AJAXY type response. Plus, you know, I'm probably kicking out to some, you know, standalone JavaScript file for some stuff. WordPress, few years back, in supposed to created a a REST API solution.

Andrew:

So I'd probably end up have to spin up kind of a new endpoint to satisfy whatever I'm kinda searching, figuring out how I would Yeah. Temp figuring out how I would template. Right? Because right now that template is is just a big old string of echoed HTML. And and I I I don't have a way to elegantly reuse that HTML without, you know, spending a long, long time on it.

Andrew:

So it's hard to describe it. I can put if I can have access to the to the markup, if I can find that div or I can, you know, and I could put an ID on it, you know, some sort of HTML results, then I could build my own form. All right. That's great because that's ground up, add a few attributes and HX select. I know you've talked about that before on one of your, season 1 episodes.

Andrew:

The saving grace for these type of projects where you don't really have much control over the output of the markup that you can You can the page is going to refresh and that that code that's been there for 10 years is still going to spit out a list of of, companies in this case and, you're able to you're able to filter that out with it. So

Lazarus:

Just use the HX select, take what you want from it. You don't have to set up your own endpoints. Alright? Is it this is kinda what you're talking about?

Andrew:

No no endpoints. No JavaScript files. I think the only thing I did for this particular one is I I did a little PHP include so that I could I could tuck my my form away in a in a separate file so I could reason about it. But there was no rest endpoint.

Lazarus:

Make it make your life a little easier.

Andrew:

And Yeah. So I could see Yeah. And it's What's also interesting is it was easy to do, which is always nice, but it was also stable. And and it Right. And it I did introduce right I didn't introduce a bug, right, because there was kind of the spaghetti code of outputting the existing stuff that was there.

Andrew:

I also really confident that my changes did again, introduce a bug or have something like that. And and I feel like anybody could come back. I could come back in 6 months and reason about at least the the portion that we added. And you don't need to understand the whole model of what's going on in this application to make a change like that. So, again, one of the things that is probably the most Yeah.

Andrew:

It's just it's tough to describe because it's tough to describe that feeling of how great it is to be able to use a tool like that. And and that's the integration part. I as as clever as I think I've gotten with some of the stuff I've built or or even took other popular packages that are out there for these type of dynamic extension or, extending WordPress to be dynamic in this way, there's no way. There's no way that it it feels gross, and, it doesn't feel nearly as much of a win for myself.

Lazarus:

Yeah and like if you were like just like I'm trying to even like get a mental model of if you were gonna try to, you know, integrate a like react or a next sort of like plugin that where you had to keep the you had to run the npm on it. You had to keep that version up to date. You had to sort of match that stuff up and then figure out a way it's like that's kind of you have to you have to change your whole dynamic for And I don't I don't even know if WordPress sort of even supports that, but whether it does or not you have to make such major changes to any kind of site if you're gonna sort of try to change it into that style of application.

Andrew:

Yes. And and, you know, a a 100%. And while I'm sure myself and other devs would love to roll over sleeves and get the thing done, but these are also client projects. Right? These these are things that don't have unlimited time.

Andrew:

These are these are you got 2 hours to do it type type type things or at least the budget is for these type of kind of smaller things. So the gigantic win there and and that's a good point that's a good point too, you know, especially if you come from other ecosystems like Laravel is the other reality is you might I think this particular project, I didn't even bother. There was the original theme developer did have, some build tools in place and but I think it was some version of Gulp or Grunt that was like, that's what they're using to compile. So even if I wanted to play nice, right? I think we all try at least I believe that we all try when we're looking at a code base.

Andrew:

We try to match the flavor and the style of that code base so that it's you're not going there and rebut. When you got some Grunge package that I can't seem to get working and I So I think that's also where, yeah, it's just really nice to go in there and gracefully add something and also not give up. Right? You're not giving up functionality. It's not like you're going in to HTMLX and saying, hey, I get it.

Andrew:

We can't we can't do, I used to be big into Vue. Js. I can't go in there and do a whole new Vue app, which sounds good. I'm going to have unbelievable power behind Vue. But it's it's not like I'm going there with HTMX and then feeling like I'm giving some sort of, like, subpar deliverable.

Andrew:

Like, fully that Right. Especially, if I need Alpine. Alpine, the same story. Those 2 have the very same story. If you if you you could touch the regardless of the spaghettiness of the code, if you could touch the markup.

Lazarus:

Yeah. It's like operating on this outer layer that just, like, everything has that outer layer. So if you try to, you know, well, if you a lot of other stuff so even, like, you know, I work mainly in Laravel, and and I have some projects that are still in Laravel 5.4 or whatever, And, yes, I should have, you know, upgraded them over time, and that would have been nice. And those those code bases, but, you know, I just haven't I haven't been able to, I haven't had the time, I haven't had the the need really because they're just sitting there working. That's fine.

Lazarus:

And if I were to go in, it's like the layer that you change the Laravel version is very deep, and that's the same with, like, if I need to go in there and change view, I have some of them are view projects too. And it's like I have to go in and I gotta figure out, okay, what has changed in view? And I've got to swap out the original sort of view setup that I had and and replace all that. And if I have to swap out the Laravel version and upgrade that, you know, there's tools to kind of help with that. But you've to get it to a modern current thing, you have to go deep and change things and get it to a modern current day thing, And it Yeah.

Lazarus:

It feels like this because I've had the same experience you're talking about with with looking at older code bases and finding a way to to add some really fancy feature to it. And I go through the same thought process of like, okay, here's I know there's good tools to do this. And when I have started using htmx, which I think sounds like similar to what you're doing is basically every single, application at this point. I just can go in there paste in, you know, your one include, and then and that's it. I'm that's all that's the only layer I'm touching is, like, as long as I have access to that.

Lazarus:

Yep. And the HTML. So, yeah, it's pretty it's pretty wild.

Andrew:

That that's a great I think I think that's it. I think I know, you know, again, I do with the day job work WordPress, but I think that's if you zoom out for WordPress or, even Laravel, the the magic in it, the the the simplicity that that can empower is if you got access to that div, you're golden. Right? The the the Right. Yeah.

Andrew:

And because, you know and again, it's it's great. You know? I I I'm not adverse to JavaScript and I I know of course, h six is a JavaScript, library. But, you know, if you have if you could put those attributes on that div, go to the front end, forget what the back end templating logic is, if it's Ruby, it doesn't matter. It doesn't matter if it's good code, bad code.

Andrew:

If you can do it and you can view it in the browser and I can see the attributes there, then I can refresh dynamically that page, you know, through, through HTMX, right? Make that Ajax call and I can see the response and I can select whatever I want out of it. And it's it doesn't matter. It's such that's why I mean, the the integration to WordPress is kind of I think it varies the headline. And the headline is no matter what you have on the stack, if you can add an attribute, an HTML attributes to some part of the the DIV or the gumtree in the back end, wherever it's producing that HTML and serving it.

Andrew:

There's not a story that I've run across where I can't get my job done. And again, I've built things that are dynamic quizzes, multi step quizzes, the form field filters. I just I have not run across a scenario, that I wasn't able to build for the the stuff I do in, I do day in day out at work.

Lazarus:

Yes. I mean, so I've always, like, thought of WordPress as kind of a closed system. You know, they have their plugins and I I I've never really I I've sort of understood, I guess, that you can customize some things, but personally I feel like I would never. Like, I would maybe I would if I actually got into it, but I would be like a little scared to go into some of these, you know, WordPress has its it just looks like everything's already set up. I've always thought of it as a closed system.

Lazarus:

So kind of one of the reasons I kind of wanted to talk to you to ask you about it is, like, bringing h tmx into that closed system. It sounds like it's actually not that closed. Like you as the programmer running at a WordPress site, you're able to access, you know, which which files are included and you're able to make those PHP changes generally?

Andrew:

100%. Right? So there's definitely 2. Right? With with, yeah.

Andrew:

I mean, WordPress as a admin panel, I mean, there are ways to extend it, but that the admin panel is its strength. You know, you typically keep for simplicity, but you typically keep the admin panel and its editing experience. Like, it does that well. Right? Where where you typically and at least my my experience with WordPress, I can go in there and you can they give you ways to hook into things and make some edits, but and and kind of make the admin panel do something, by extending it in whatever way you see fit as developer.

Andrew:

But where I really spend most of my time is, on the front end. Right? So by default, you can absolutely just install, create a brand new theme, and have an index. Php file in that theme and it'd be blank, right? And then you could pull the stuff and there's a WordPress y way to pull things out, right?

Andrew:

At Laravel, we have Eloquent. And, although this is probably not a big a great comparison, but there are ways to grab that stuff that some client put in the admin panel and and make those database queries and and pull out that list of blog posts or or list of to dos if they've added to dos to the back of the panel. So because you're starting with a blank index dot PHP file, at the most primitive, well, there you go. You're off to the races. Right?

Andrew:

You technically could scaffold up an entire project or an entire, theme and choose kind of where you wanna go with it. So it does have that. Yep. I I just don't think it's a it's you know, you've been around development such a long time. The reason I just don't think it's known I mean, I I'll give you an example.

Andrew:

I I the reason I I built the, that integration, the adapter for inertia JS that I brought up earlier, The reason I built it is in the inertia, discussions or in kind of maybe one of the issues on GitHub, I found a thread of like, Yeah, WordPress can't do that. Everybody just stop. You can't it just can't it can't happen. And I think, well, not being true, but I think where that comes from is because quite a few people just buy a pre made theme from somewhere or install one of the free ones that are available and are never the wiser. Right?

Andrew:

It it takes that extra level of like, oh, okay. Well, under the hood, this has gotta be code. And under the hood, I can't start with a blank file. I mean, I'm responsible for everything ground up. But I just don't think that's the user I just don't think that's the user story for most people.

Andrew:

So you typically think it's this closed system and it's really rigid and especially these themes where it's it's if you, you know, you buy a third party theme from a site and even if you went in there and made some changes, you know, their changes will be overwritten when they kind of update the theme. There's ways around this. But Right. So I yeah. But I I I definitely started, when I went down that rabbit hole, it it can it can pretty much do anything because you can start with blank files.

Andrew:

But, again, not not the typical story for sure.

Lazarus:

Wow. No. I mean, it's it's I were I always have thought of WordPress as if someone doesn't quite need, you know, what? I tend to build web apps, and I sort of think of them as, like, if they if they come to me and what they really need is a CMS and they need, you know, something that's not really logging in and changing data and like, you know, having all their users log in and do something. I'm generally thinking, you know, WordPress is is I kind of direct them even though I don't really have never really known.

Lazarus:

I haven't gone deep into WordPress, but it's just so popular and there's so many people building stuff with it that I feel like that's usually a good option for somebody who's who's not looking for that full Sass app.

Andrew:

Yeah.

Lazarus:

But yeah. So I mean there's like I don't know how many thousands and thousands of WordPress developers there are, but, like, do you do you think and this isn't something, you know, do you think just, like, speculatively, is this something people could build plugins around HTMLX, or is it kind of separate where if they're doing something custom, you know, that's sort of separate from the plug in world, that's like they're using h t f x to customize within their app around other plugins.

Andrew:

Well Yeah. This is

Lazarus:

purely speculative here.

Andrew:

Well, I mean, it's not too speculative because I I have built plugins that that use h t m x. That but it definitely wouldn't be

Lazarus:

Okay.

Andrew:

Yeah. I yeah. There yep. I have built plugins. And I'd say HTMX.

Andrew:

I think I did come across, so there was somebody that created a plugin and, I took like 2 minutes to look at the code base. But essentially, what it does is you install it and you have HTMLX available, right, on the window object. Right? So it just it just installs it. But that doesn't really do anything.

Andrew:

It just gives the developer, you know, kind of opportunity to build something with it. But I wouldn't Yeah. I don't see a story where you're just adding HTMLX for the sake of and and and then retrofitting some existing functionality, you know, from another third party plugin that you didn't build or maybe even something kind of in the core, code base of WordPress. But if you are building a plugin and more importantly, that plugin there to solve a very specific thing. I built a, full of the cancer sites.

Andrew:

They needed a dynamic map to show all the treatment centers around the country. So built a brand new plugin in addition to, you know, creating the map, SVG, and have all the list. I mean, I do all the tailwind stuff. At some point, that needed to become dynamic. Right?

Andrew:

So as a whole package of a plugin, absolutely. You know, the the plugins are interesting. Like I said, it's it's it's not talked about because again, the the point of, I think, WordPress is to give anybody this really easy CMS where they go in there and start typing, adding content without ever thinking about the developer experience. But a but a plugin, again, starting kinda back with that blank that blank index dot PHP file, and then you can kinda do anything from there. So, yes, I used it.

Andrew:

I think I've built these kind of dynamic plugins using that map as an example. Again, same story as with my themes. I I don't think there's a a plugin I've created that doesn't integrate, HTMX in it.

Lazarus:

Wow. Yeah. I mean, it's like the sort of stuff you can I mean, it's a front end framework? It's like a full front end framework. The sort of stuff you can do with it.

Lazarus:

I'm just, like, you know, I picture some of these older WordPress sites and, like, imagine okay. Well, you just install this like one little plugin, and suddenly you've got, I don't know, server socket setup. You've got like, you know, you got live updates through polling or something. You've got like just this kind of world of of interactivity that I don't see being able to integrate in other ways. So it's, it just seems like with that many developers out there, it's kind of a cool maybe a cool airy.

Lazarus:

Just kind of a cool realm to be in.

Andrew:

Yeah. It it definitely is. Yeah. It it, you know, and you got me, like, one of the things I wanna try to and I've mentioned earlier that there's that popular word, e commerce plugin called WooCommerce. And as you'd imagine, when you install this this plugin, it gives you this idea of having a shop page, right, where it's gonna have a a list of all of your your products and then a single page to kind of display the details about that individual product.

Andrew:

And that page where you're filtering So let's say you've got that shop page and maybe you want to sort by price or something, right? Or you want to sort by popularity. I could be wrong and haven't used it in a while, but I I believe when you you use those built in features, the sort by price, it does a full page refresh and just throws the the the the the pram up in the query string in the URL, and then it filters based off of there. And they give you ways and and these these plugins give you ways for other developers to hook into them and and and and modify their behavior in some sort of way. And that can get tricky, right?

Andrew:

Modifying something is always an interesting story. But with HTMX, I did this as a proof of concept. I haven't needed to use it in the real world, but I decided a div. I wrapped that entire thing in a div, Right? That was an easy integration.

Lazarus:

Yep.

Andrew:

And now because I can just intercept that request that would normally be a full page. That form's going to behave like it exactly behaves. I don't have to do anything there. I can intercept that request and, yep, make that same request to the server. Right?

Andrew:

The server doesn't care. WooCommerce doesn't care that that it was initiated this way. It's gonna it's gonna, you know, rerender the whole HTML output, but this course is gonna be pre. This time, it'll have those things filtered out. And now I've in two lines of code

Lazarus:

Yep.

Andrew:

You know, created I turn your and at a and if WooCommerce adds a new filter to that filter bar up there, I don't have to do anything. I'm already intercepting it. I'm using the select, right? So no matter what their markup is, unless they change the ID on the shop page itself, but even then there's ways around that. So I just don't know I'd That's fascinating.

Andrew:

Yeah. Where where it ends with what kind of its ability. I mean, I know we're specifically talking about WordPress. But, yeah, like, I just there is and again, I I, I think here's what's important. I I try to maybe remind myself of this daily is, like, it's a nice solution.

Andrew:

It's not gross. A developer is we get real we get real crafty and the stuff we build, and I'm like, that's amazing, but the code smells coming off of some of the stuff I've seen and I've built. I'm not innocent here. I just I don't get that very I got to really goof up adding HTMX to something where it starts to feel like, oops. This is gross.

Lazarus:

Yeah. It's usually super clear when you look at it, like, roughly what is happening. Like, there's just like so Yeah. It's like I feel like I don't have to keep as much in my head when, like, if I'm building when I build something really fancy in the past, and like and I go back to it. I'm like, oh, well, I was pretty clever at the time, but I sure screwed myself now because like now I don't understand it.

Lazarus:

And I yeah. I haven't had that experience yet with, the h tmx stuff where it's like it's right there in front of you. So it's like not doesn't get to be that complicated.

Andrew:

A 100 percent agree. Yeah.

Lazarus:

Alright, so yeah, maybe, I think we're we're about at the hour mark, but, anything you want to shout out or or kind of, promote while you're here?

Andrew:

Yeah. I don't think so. I had a couple things, but I think that we're able to pepper them throughout our conversation. So I I feel pretty good.

Lazarus:

Nice. Well, this was this was really awesome and, I WordPress has always been kind of a little it's a little mysterious to me. And, so I'm I, I really appreciate you, talking through some of it, and, I think it's like it's an interesting place for considering it's so much of the web. It's really it's kinda just crazy to think the kind of stuff that could be integrated into it going forward.

Andrew:

Yeah. I think I I'm I agree. I think it maybe inspired me to, to I'll do a little bit better job of maybe sharing some of some of these HTMX wins that I have with WordPress maybe, on Twitter or something. Right? Just kind of kinda sharing and and showing kind of what's what is what is possible, again, at least for my corner of the world.

Andrew:

And I think a lot of people are are doing that from their own corners of the world.

Lazarus:

Yeah. No. Look out for it. Alright. Cool.

Lazarus:

Well, thank you very much for for coming on.

Andrew:

No problem. Yeah. Thanks for having me.

Wordpress and htmx: A conversation with developer Andrew Rhyand
Broadcast by