 So this is going to be lightning talks. I'm going to keep this as brief as possible. So we have more time for q&a So i'm going to keep it very precise generic and i'm going to try to smash as much information into your head as i can in the shortest amount possible with the flickering stuff that's going on. If you wonder about the puppy, the puppy, it's because it's the year of the dog. So let's celebrate that. Hey, year of the dog. That's the energy. All right. So what i'm going to go over here today is first of all, who am i to tell you stuff about word per staff. Second, we're going to go over some examples of what hooks can do and how they can help you. And finally, i'm going to go over how to use hooks while the screen is flashing left and right. Funny enough, that's exactly what happened with my presentation before. I don't know. They just don't like me. That being said, let's start off with who i am. For today, you can call me captain hook because i'm going to explain you what hooks are and what they do. My real name is Andreas Lopez. Don't get it wrong though. I am actually from Germany. I took my wife's name. It's always a nice story to hear that i love to tell. You want to, yeah, okay, let's try that. So i've been a webmaster for four years. I don't use the term web developer or designer because i'm more than that. I don't work for an agency. I don't do freelance work only. I actually work in house at a local company in this point beach, florida. And i do everything they need. That means that they need an email set up. I'm actually giving tech support in there. I am making the websites with a crew of three people, including me. And so that's why i consider myself a webmaster. Also because i do a bit php work, i do mostly design, working with the Work commerce, work with the themes and plugins available to us. And so through the years, i consider myself now an e-commerce expert. That's where my strength lies and actually how i, so how is this relevant? That's how i got into the hooks in the first place. Because there's a lot of stuff that automatic left for us to Utilize inside of work commerce. They made a really great job because everybody is used to storefront, right? Everybody has when they use work commerce, the first thing you Encounter is storefront, this ominous theme. And everybody uses it and loves it, but there's so much more you Can do for your brand to not look like a WordPress site. Everybody knows when they encounter bootstrap site. You don't want to be that guy. Sure, it's only us developers knowing it, but you will be happy In knowing your site looks and feels different for better. So i was born and raised in Germany. That's where my weird accent comes from. I'm working on getting rid of that, but it's not really working. And that's me in Colorado actually like two years ago. I was really happy because i says no. You don't get that stuff down here. You don't. So this is a really, really, Really simple example of what hooks can do. Like captain hook here shows us i changed the logo and i made Some text in there, right? because everybody knows the WordPress back and login. What if i told you if you did Freelance work, you don't want to say WordPress. Why do you need a plugin to change the login page that Only box your site down? it makes no sense to have a Page to change the login page. It makes no sense. Sure, you're going to need a bit php skills. I'm going to go over a bit later. But so why, right? why? Purps, you want whoever you make the site for, you want them To be able to use WordPress to change the content, add New products, edit products, remove products, make a sale. Or purps, you made a really simple site for somebody who Can't access the blog. So now they need to go get in there And access the blog. And when you see this WordPress Logo they never saw before because they're not developers like you. They don't know what WordPress is. They don't care either. They're just going to be like, what is this? And if their logo would be on there, they would not even care. So you just eliminated another step for them to question Your abilities. Like why do you need It somebody else? i got this question actually before. And the text down there that could be helpful for if you have A client who has purps like multiple sites. And then you're like, oh, yeah, this is the word can Miami site. Don't worry about it. But if you, for example, had, let's say, second store, and Then you can tell them, look, this is the other store. This is WordPress store. Not word can Miami store. This is a different thing. Now here's an example of one Of the in-house product pages i've worked on. And this is how it looks out of the box more or less. I mean, i added some stuff. But this is how it looked before. And then actually like a month before word camp, i looked And was like, i need an example for the hooks. So let me make one. Bam. Again, before, regular WordPress, WooCommerce looking thing, completely customized. No more annoying tabs. Nobody clicks on tabs. Nobody needs tabs. Get rid of the tabs if you can. Nobody clicks on those ever. The price is right in your face, First thing, along with the add to cart. And so it's like, because here it was like right in the middle, That's too far down, we sat. So like right there where your Eye naturally lands. Because in the western civilization, We read left to right. So we wanted it exactly where Your eyes automatically go. Because if you open a book, You're not going to stand on the right side. Makes no sense. You're going to look first thing, Upper left. And that's where you want the action to happen. Subscribe here. Sign up on our newsletter. Check out our newest posts. This and that. Top left is where your eyes naturally land the first thing. That's where you put the add to cart button there. How much time is left? mc. All right. So these two buttons. And actually put a code in there, too. By the way, all the slides are going to be up anyway later on. You can just e-mail me and stuff. And here, our idea was the archive pages can get very long Because we have thousands of products. And what if you want multiple products? You want me to click into product, add to cart, And then go all the way back. No, no, no, no. It doesn't even refresh the page. And look at the code. Look at the code. Let's have one, two, three, four, five, six, seven lines. Even though i could just put it up there and then call it a day. Seven lines of code to just make that happen. A quick add to cart button, which is not native to WooCommerce for, i don't know what good reason. But so let's look at the hook. Our hook here is add action. We have six in total of hooks. Add action, remove action. And then we have the filters, which you can add one or remove One. And then you can add so. God, of course, the terms fell out of my head. Anyway, you have six different hooks that you can use, which Are free action and free filters. We had to use an action here because a filter only changes Existing functions. But we needed to put a new Function in there. And so the first that i highlighted in blue WooCommerce after shop loop item title tells us when is this Happening. So that is the first part we need for hook. We need to learn of where it is so we can modify it. And i only know it's an add action because i looked at the source code. For any action, you will always need to reference the source code Because you don't know what they call it. And you won't just find it in the page source. You won't find it with an inspect element tool. You will have to go through the source code. For WooCommerce, there's a references guide, which is very Useful. And on wordpress itself, we have the codex. Use that. You can dig through that. And then stand by. No. And then the rest of it is just a regular function. So our hook element is this blue part. That's the core. After that, so what function? Well, the function is WooCommerce quick add to cart because that's what i called it. So the second part in your hook will be which function do i Do now when i reach this point. And then i had to call out Of course global product because i need to access the Variable data such as the id, the title, this and that. Because right after that, i actually access the id. Well, the variable id equals variable product and get id, Which is a regular function from WooCommerce and wordpress. So you're not creating something completely new and put it Somewhere in the source code of anything. You're just piggyback writing on something that automatic Left us behind. Because they knew we were going to Use this and they were like, here, use this. Go ahead, use it, grab it. Do whatever you want with it. And then i just echo a short code out which, again, is Actually in the WooCommerce guide. They have it in their product documentation where you can Just go in there and be like, oh, what short code is Available and i just called it out after grabbing the id. And now if i were, and that's where you can see the Various ones say select options. Very strange. Why does it say select options? Because it's a variable product. So you can't quick add to cart a variable product. It won't happen. But on the simple product, just add to Cart. Done. Call it a day. So if you would click to select options, it would get you to the product page. And the great thing is you can do so much with it. I could make a filter which would go into the shop loop item title And, for example, make a prefix. I could, like, for example, i wanted Everything to say a certain phrase beforehand, which, of Course, makes some products less fenced, send it on, say, A blog article. You want to make sure each of These says your website name first. Or perhaps the category. Or sale, exactly. You can do that like that with a filter. And so here's the checklist of what you need before going Using hooks. First of all, use a child theme Because everything for the hooks necessary will go into your Functions php file. If you don't know what it is, Hooks might be not for you or you just have to start learning. Starts like i had to. Because i'm not a php developer. I just learned it on the go by experimenting with child themes and word press. And i'm telling you, you are going to Break your site. You are going to. If you never used hooks before and you're going to start Using it, you're going to break your site. That's why you need step two, ftp login. You have to have a way to get back into your site, into the Functions php file, and add or remove the code as you Need to, because you're going to break your site. One time, you're going to forget the same e-con. You're going to make a wrong call out. Or something else is going to happen, which is very strange. And third, of course, you're going to need to know what hook it Was. Like, for example, i knew it Was in the loop product type. I knew it was there. So you're going to have to figure out what do you need To reference here? Do you need to reference a filter? Or do you need to reference an action? Two different things. And then number four, Of course, what is the function you actually want to do? Do you want to echo a short code? Do you want to echo just regular text before or after? Do you want perhaps to just completely get rid of it? Because it's like the theme or the plugin is doing something You don't want? Or is it something completely else? Before you start working with the hook, you have to know What is my function going to be? so i actually suggest Even before you start working with the hook, make the Function. Make the function at least Pseudo-coded for the people who don't know what it is. Write it down in layman terms. What do you want it to do? Like, first, i wanted to make a button. Second, i wanted to grab the link of the product so that They can easily access it. Write it down. Think about it first before you start working with a hook. Because it might be that you're looking at the wrong hook. Because you have to look at what you want to do and when it has to happen. That has to both come together. Not every plugin, not every theme Has these hooks necessarily. That's why i keep emphasizing Wordpress and book commerce, too, because automatic made them. And they made it accessible. So i bag every single plugin Developer, every single theme developer that's sitting here. I bag you. Please add hooks. You don't know what we're going to do with them. Give us the option. Don't worry about how You want the user to experience it. If you're worried about that, build it in. But also allow us to change it. That's the only thing i'm asking of everybody who makes plugins and themes here. And i think, of course, five, we've got to find peter pan. Where's peter pan? Nope, not here. I guess i have to say thank you and go look for peter pan Somewhere else and work in miami since i'm captain hook of the day. There's my contact information. My github page is currently empty. If you guys are going to visit it, there's nothing on there. Just started it. And you will actually find some hooks And references. I'm going to put them all there. Such as my quick add to card and some other neat functionality. Three minutes, i see. All right. I'm also going to be available in the happiness bar. I have 30 print outs, handouts that i'm going to do Once we wrap up here. And i got speaker cards, too, So let's do q and a. Questions? Anyone have questions? Yeah. It is a great solution and actually talk. Oh, sorry, sorry. He's asking of we got Breaking the site if a local development would fix the problem. Yes. The reason why i didn't speak to that is Actually because i didn't plan for my presentation but i talked to fly Earlier today. I'm not sponsored by them. It's just something i came across. And i asked them, hey, is it Local by flywheel? that's basically local word for Development that you can easily push to your actual live Website. Is it finally available for windows? And they said, yeah. Because last year it was still Better. Now it's available. So i actually suggest if you're interested in having a safe Environment, hit flywheel up. They are in the main Registration room stuff. And yeah, that would actually help. Okay, what he just said is that most hosting companies these days Have like a one-click stage in store, which else would be the Solution. I personally like to develop Life. I don't know why. I like to live dangerously. Let's just hope no Crocodile comes through my hands. All right, other questions? Oh, great question. So he's asking if i'm only using it for design and Layout aspects? No. He has great back-end things you can use with that. Imagine you're making an export tool, even though WooCommerce has it now native, and then you would have to Loop and grab all sorts of data. There would be a great tool For the hooks, because you can just, again, piggyback Right what other developers did before you and just run the Functions as if they were doing it, because they have Already the functionality, sorry, to loop through every Product you ever made, because that's how they make their Archive pages. So there are definitely other Purposes than just design that you can do with different hooks. And again, by the way, on the action of filters, filters Is not just to change text, it's also to change attributes. One common problem i had that i fixed with the filter was Related and upsell items on WooCommerce. Anybody ever experience that only displayed free related or upsell Items on WooCommerce? if you have that problem, they fixed it Now, i think, with the latest version of WooCommerce, but You can also change it with a filter that you can force it To, for example, only output like eight items or four items Or how many items you wanted to. You can do that, for example, with a filter. Other questions? Thank you, Andreas.