Fluent Snippets: Brand New Code Snippets Plugin With A Twist
This new code snippets plugin kinda blew the others away by doing something very different that the others don’t. They kinda nailed it. It is called Fluent Snippets. And it is free, too. You’re going to like is.
Transcript Of This Video
[00:00:00.21]
Just a few hours ago, Fluent Snippets was released. Let’s talk about what makes this a very interesting Code Snippets plugin. So there are a lot of Code Snippets plugins for WordPress out there, like WP Code, which is from the awesome mode of people, but the one I usually use is just called Code Snippets. And the thing is, a lot of these Snippets plugins, they have an interesting thing in common, and that is that they store all the snippets inside of your database. And then so basically your plugin, excuse me, is basically querying that database, running an eval on it in order to execute that code, and it does what it does. Now it works. I’ve been using it that way for a long time because we never had an any other option, right? Well, now we do. And it points out an interesting thing here with the other plugins, because there’s a couple of things. One is when those plugins are pulling out of the database, there is going to be a performance hit there because it’s actually having to run a bunch of queries and things like that. The other thing is that there are potentially security issues because if something was able to put arbitrary code into the database and any various security holes, maybe they’re on an unmaintained site, you could actually get that snippet to run.
[00:01:21.28]
And so it’s basically when you can move everything into the file system instead of querying it from the database, it’s going to be secure, and it’s also going to be fast because you no longer need to run any extra queries. It’s all coming right out of the file system. You probably know if you’ve done any work with WordPress is that most of the time, if you are going to add a file snippet, the way we’ve always done it before was that we would manually put that code into the functions. Php file of the theme. And then that way it’s actually being pulled in from the file system. It’s nice and fast that way. The thing is, when we go with a code snippets plugin because it’s inevitable, It’s just going to always be more convenient to do it that way. We take the performance hit of having yet another plugin installed, and then it’s also a plugin that makes data bearish queries. Well, with Fluent Snippets that just came out from the same guys, obviously, before Fluent CRM and all that stuff, they’ve solved it, and they’ve done a really pretty good job. And the other thing, too, I’m going to show you this.
[00:02:23.18]
I think they’ve done a really good job of actually surpassing the other plugin. So not only is it doing It all via the file system, which is better for performance, but they’ve got some really cool conditional logic in this, which is freaking awesome. So let me show you. So here’s Fluent Snippets. I’ve set it up on a staging site here, and it’s really simple. It’s basically what you would expect from such a plugin. You can put in stuff into the functions. Php file, but even though that’s not where it’s going, but it is going into the file system. You could put in content using PHP and HTML combined. You You can do style sheets, you can do JavaScript. So every code you probably would need to put in there. If you open up, here’s one for declaring a post type. You open this thing up and we’re going to have the editor. There it is. There’s the code that is actually creating this custom post type rather than using a plugin, so it’s a little bit more efficient that way. And we can give it a name, we can give it a description, we can add it to different groups so we can group all of our snippets together.
[00:03:29.08]
I haven’t really I haven’t done this yet because I just got started. You could, of course, assign your priority, which interestingly, at this point, seems to be quite relevant because with the traditional snippet plugins, I just usually left it at default 10, okay? Now, when I did that here, I actually found that my post type was not showing up. It actually wasn’t being declared properly. So I had to bring it all the way down to one, and suddenly it showed up. And so the priority thing definitely does seem to be a little bit more relevant here than typical. Maybe that’s something that they’ll fix in a different version, even if it’s a problem. As far as I’m concerned, as long as I can run my snippets, I don’t really care. And then, of course, you got tagging as well in order to have an organizational structure with all of your snippets. Now, what’s interesting is when you go down here, we could choose where we want to run it. This is standard stuff. Do we want to run it everywhere, only in the admin panel or on only the front-end? Most of the time, we run it everywhere, but sometimes there are exceptions.
[00:04:29.14]
This here under the advanced conditional logic is quite cool. Look at this. We can add, we can go by user, where they’re logged in, what their user role is, what page they’re on, category, URL. Basically, what we’re doing, we’re saying we can only run this snippet in certain locations and ignore it everywhere else. This is not something that we had the option of doing with the other plugins, at least the ones that I’ve tried. Look at this, day of the week. And This one’s really, really cool. If you’re using Fluent CRM, you can now have snippets that will run only in the case of whether people are on a particular list, whether they’re tagged a certain way. I have never seen anything like this. This is literally the only snippets program I’ve ever seen that has this capability. The other thing that’s interesting about this when you go over to settings, is they’ve got some options here that will allow you to essentially run these snippets because they are the file system, right? But run them even if fluent snippets is not active any longer. That’s neat, right? It also has a capability of that if one of your snippets breaks something, it should automatically deactivate it.
[00:05:43.10]
When it detects a fatal error it will turn itself off. So these are all things that I have not seen with the other snippets manager. It’s quite interesting. And this is going to be my new go-to. I’m not going to use the other one anymore. I mean, you could see here with snippets, I’ve got this is what I standardly really use. There’s a snippets program here, but I’m going to move everything over to fluence snippets because this seems like this is the superior way to go. So it’ll be interesting to see how they develop this thing further. I think they may have some interesting options if they want to put a cloud code repository thing in there. I think there’s some cool things they could do with that. Also having import-export functionality because right now it doesn’t have it. Although being that it is a file-based system now because it’s storing all your snippets that way, I would imagine you could probably just clone the whole folder and copy it into another website. But at the end of the day, if you could do it via the UI, I think that would really be cool, especially for agencies where we might be having a library of snippets that we reuse a lot of times on other clients.
[00:06:45.29]
We can go in there, use fluent snippets, get everything in place. It’ll run in a very performant way. And then if we even want to, we’ll just deactivate fluent snippets because it’s not needed anymore. You just have that mode enabled and everything would continuing to work. So that’s super, super convenient. Cool thing is, too, the program is completely and totally free, and they’re not going to charge for it. So at the end of the day, this is the new standard, in my opinion. That conditional logic and that ability, and it just stands out above all the other snippets programs. I mean, I’ve seen a lot of other plugins that do code snippets. At the end of the day, they all have different UIs on the same basic functionality. I haven’t seen one do anything different in a long time. Well, they just did. They just did it completely different. And in my opinion, this just became the go-to. Fluent Snippets. It’s free in the repository. It’s brand-spanking new. Just came out a few hours ago. It’ll be interesting to see what they do with it moving forward. Well done, guys. Talk to you guys later.