 Okay so I'm Michael Hall, local developer here in Asheville. I guess most of the work I do these days is WordPress although a lot of what I'm going to talk about is sort of approaching coding and I guess in particular PHP from the standpoint of someone who didn't who sort of learned that stuff before WordPress and had to sort of figure out what's the optimal way to do stuff in WordPress and really the heart of what I want to talk about is this whole process of generalization. I come from a math background and so this is like this is really what inspires me to like work harder work longer work more you know to make your stuff not just apply to your one immediate situation but make your solutions apply to like a wider class of stuff. So I would kind of define this process as saying you know you start with one or more known facts or solutions use and expand on these together and classify a wider variety of facts and solutions and then repeat. So that's a real basic breakdown of this process which for me carries over from studying math a lot of things between math and computer programming are so similar that you know it's it's all pretty applicable and I have a disclaimer here due to excessive study of mathematics this speaker is trained and equipped to use the above process thoroughly and actually I'm just going to level with you so this is actually a confession not a disclaimer. Due to excessive study of mathematics this speaker is obsessed with and addicted to using the above process constantly. So that's you know that's my motivation for this talk like that's what I love to do that's what motivates me. If I build something and I'd use it one time I'm a little bit disappointed if I can't like pick it up and use it again for a different project. So a quick example non-word press related right now this guy. Anybody know who this guy is? Here's a hint it's not me wearing a robe in a headband. No it's an ancient Greek mathematician called Euclid. So this guy was around in like 300 BC and he's kind of my hero. He didn't do any computer programming obviously but he probably could have if it existed back then. I don't know this guy just sort of interests me to no end. Basically he compiled a 13-volume geometry book which is actually like still kind of the heart of the geometry that we learn or try to learn in like middle school and high school right and he put all this stuff together back in like 300 BC. So he basically started with real simple assumptions and said alright here's the definitions I'm going to use here's the assumptions I'm going to base everything on I'm not going to prove them because they're assumptions I'm assuming they're true and from that little seed he started to prove one thing and then he used that thing to prove another thing and he used those two things to prove more stuff and he ended up with this 13-volume book that is still really influential like 2000 something years later because it was just put together so well and so kind of an idea from his book that I guess I can sort of take a little bit further. There's this idea how many people know about the Pythagorean theorem. You probably did not expect to hear that today right? Who can like state a version of it? Okay so what's the context there? Yeah so we're talking about a right triangle. Let me just give you one. There it is. Right so we all kind of probably remember this at least seeing it at some point. So if you know A and B and you're trying to find C, C would be the hypotenuse there. Pretty simple and easy formula that's not actually C but you can just take the square root and you got your answer. So you know think about this for a second. This is like one specific triangle or type of triangle right? The thing that this hinges on is you have to have a 90-degree angle right here. If you don't well you can't really use this formula. So what I'm trying to get at is maybe how could we take this one known fact and like generalize it to like speak to more triangles and tell us stuff about different triangles. So here's sort of a different triangle. Notice we don't have a right triangle anymore. We just have this is a letter theta so we have the angle theta. It's the exact same thing except it's no longer 90 degrees right? So you might say well it works before or why wouldn't it work again right? Turns out not to be true but all you have to do is tag on this little extra little piece and what I'm about to show you next basically took I don't know maybe 3,000 something years to evolve from triangle one to triangle two right? So you take basically what is the Pythagorean theorem and you just have this other little piece. Just simply subtract 2ab times cosine theta. So you know what my point is here is basically this is way better because it talks about all triangles right? This is cool but not as cool because it only talks about one particular type of triangle. So what you're probably wondering now I'm sure is hey I thought this was about WordPress. Why are we looking at triangles? But that little tiny little example is kind of like most of the work that I do is revolving around that same idea. You know let's take one particular thing and let's figure out it's going to take more work hopefully won't take 3,000 years but it's going to take more work. Let's just figure out how we can take this and like make it better so that it applies to more cases and that's really kind of the thing at the core when I'm doing development is what I'm always thinking about. So really the way I relate this to WordPress you can think of a child theme as like one specific case right? That's not absolutely true but usually when you have a child theme you're kind of just using it on one site again that's not always true but more or less in my experience that's usually what I'm doing. So when I first started working in WordPress I learned about child themes and saw that there was this functions dot PHP where you can put all your code in there and it just kind of magically gets read in by the system and it's great you can just put your PHP in and just go. I guess what I ended up doing was I would have stuff that was really specific to that site and then mixed in with some other stuff that I might want to like transport to a different site and I would end up with this mix of code. There's like some of it I could like chunk out and use on a different site but it was always this process of how do I like pick that functionality up and move it. So from child themes I went on to learn about making plugins and really you can think of a plugin as just it's a generalized solution right it's kind of it harnesses that idea of generalization where it's not just applying to a specific case anymore if you have a plugin you ought to be able just put that on any site whatsoever and it should work the same ideally as it does on any other site. So a lot of what I'm going to be talking about today is you know taking some stuff that you might be tempted to put in your child theme and really think about could I potentially make a plugin out of this. By the way when I say plugin I'm not necessarily talking about registering your plugin with WordPress. There is a process to do that but in case you didn't know you can pretty much just make a file on your computer or on your server or whatever and it's a plugin you don't have to like get it approved or registered you can just go ahead and make it and start using it yourself which is a really cool thing. Like I said generalizing is way easier said than done I can't tell you how many times I've done something specific on one site and then been like cool I want to reuse this and then oh well this site's different so I have to like you know make it I don't want to break it to where it doesn't work on the old site anymore right so you have to keep that working and then also make it work on this new site at the same time and so you really do get into this mode of you know I can't think too much about the specific site I'm using this on I have to think big like let's just pretend that this could be on any arbitrary given site at any time and so that really sort of helps you think a little bit deeper about the coding that you're doing and like I said the triangle example is a real good example that took like 3,000 years to get from specific to like a general solution so what I'm basically going to do sort of like a case study here and I'm gonna it's not going to be super super realistic it'll be pretty realistic I guess we're going to be mimicking some aspects here and there but the task that I came up with for this talk is essentially building like a social sharing icon set like you've probably all seen sites where you get to the end of a post and it's like share this with your friends so there's plenty of plugins out there that do this I'm not trying to build another one I'm not going to build another one this is kind of just mimicking that idea just to use it as an example so it's not going to be like a true social sharing plugin that works we're just going to try to mimic the process of how you might migrate that from your theme to a plugin so the tools we're going to be using our HTML and CSS we're going to use JavaScript and also a little bit of jQuery because I want to talk about how you know dependencies and stuff can be handled when you're dealing with JavaScript files and WordPress obviously PHP since we're in WordPress and then to handle the icons themselves I'm going to be using font awesome which if you haven't heard of that is a really cool thing it's basically a huge icon set that's not image-based it's kind of like text-based so it's not very expensive on your page load and then what I'm going to do is you know I put a lot of thought into what should this child thing be like that we're going to start with and I kind of wanted to mess it up and make it like not very good right because there's there's just a lot of things that I learned as I went in WordPress and I was doing things a really bad way and then I learned like oh yeah you shouldn't do stuff that way try doing this instead and so I kind of want to point out some of those things that I did and that I learned were actually not that good just in case somebody might be doing the same things so the child theme itself is going to be just a 2015 child theme what's this here TYCP well it's the name of this talk turn your code into a plug-in so why why would I like use that for crucial and the theme folder name but this we'll come back to you later when we start looking at files and stuff so obviously style.css and functions.php two files that are in almost every child theme I guess those are the two files that if you go like you're trying to do something on WordPress that you don't know how to and you Google maybe you find a forum post or something you know there will always be a discussion like oh we'll just add this filter in or whatever and then almost without fail the original poster will say okay well that's great but where do I put that code and usually they're like this might be a dumb question but where do I put that code and almost without fail it's going to be in one of these two files and I think my personal opinion is just because those are the two files that almost everybody has right so that's just kind of the common files that things get dumped into a lot of times I'm going to throw in a header.php and that's an example of something that is not really ideal so I'm going to kind of use it for a not-so-good reason just as an example of maybe what not to do and then I did want to have some JavaScript in there so I'll have like one JavaScript file it kind of handles the the mimicking of the sharing capability there and then I guess before we really dig into some of the coding the goals that I'm going for really just take that sharing icon functionality and just pick it up from the child theme and move it to a plugin right if you do that once then you're pretty much set you don't have to do that every time you want to you know use this sharing functionality on a different site you could just grab the plugin folder throw it in your plugins folder and go and so again that's really kind of what the main point of this talk is of course we want to make sure not to like pick up any of the pieces of the child theme that have nothing to do with our sharing icons so we want to leave the non-related stuff intact and really look out what are we picking up and moving and what needs to stay in our child theme and then also like any little gotchas that might come up as we're doing this and really quick I am going to have some code up here on the screen so if you're like on your laptop or something I have two get hub repositories that basically are holding the code that I'm going to be working with and so this is the child theme that we're going to start with at the top and then eventually we're going to end up with this plug-in so if you're if you're really wondering like how do I make my own plug-in or you know if you want to look deeper into what we're talking about you can always just kind of clone these now or later whenever I'll leave them up there indefinitely but if you wanted to follow along now if you can't read that you could certainly just clone those right now and my slides here if you wanted to find those there's the address so I'm pretty much ready to go ahead and just start digging into a little bit of code does anybody have questions before we do that okay let's go ahead and do that all right so I have basically I'm running a test site on map so this is all going to be kind of locally done here you can see my themes folder I've got my 2015 theme and then my child theme here and if we open that up you can kind of see it all those different files so I'm just going to go ahead and open up this theme folder and text wrangler with my magic command open says me opens up basically the current folder and a text wrangler window just a little shortcut that I wanted to define and I guess I didn't have text wrangler open so it might be taking a while no I was about to have to do it the long way that's good so here's our here's our child theme we have a functions dot PHP we have a style dot CSS we've got a header dot PHP and then just a real quick real small JavaScript file and the site that I'm working on here is just you can obviously tell us 2015 child theme really quick let me ask you as this what here's sort of the social sharing icons that I made here they do I'm sort of filtering on the content so if I go to basically any post I'll see those icons if this were a real world sharing plug-in you probably want some options as far as what pages does this show up on and all that kind of stuff but again this is just sort of a quick example but this will put those icons after every single post so what's kind of like the one thing maybe if you know 2015 what's the what is it about this theme other than the sharing icons that's different kind of small but they should jump out really it's just the these guys link colors and header color so I wanted to have those in there again it's kind of a trivial example but I wanted an example of something in the child theme that was not related to the sharing icons right because we don't just want to pick everything up and move it into a plug-in we just want to pick the sharing stuff up and move that so our child theme is still going to contain all this green stuff but our sharing icons are going to be sort of picked up and moved over to the plug-in so in the the style.css file you can you just kind of have all these headers which hopefully if you've made a child theme before you're familiar with you have to tell it what's your theme name right and that shows up over here my 2015 child theme right that's just the name that I'm defining and all that stuff happens in the style.css file so when we get to making a plug-in you're going to see it's really pretty similar the description here says a child theme that probably contains enough custom functionality to warrant a plug-in and so if you kind of click on the theme here again just the fact that I have that in my style.css file that's making the description here on the child theme page so again I mentioned this because when we build our plug-in it's going to work in a real similar way so what we can do here by the way this is not really the ideal way anymore to enqueue your parent style but I don't know I kind of just left it like that because again this is supposed to be a child theme that's not really ideal at all so I'm trying to point out like kind of some common things here we'll come back to that in just a little bit the main thing here that's not quite right about this child theme is what's in this header.php file right so if I look through here this is the kind of thing that I do if I'm like forced to edit a file that I really don't think I should be or like I don't want to edit a file but I don't really have any other choice especially if I'm working with other people on a project and it's not under version control and stuff like that I will just sort of make this little note like hey m-haul that's my first initial in my last name hey I edited this little part right here right and then I close it with this so I used to do this stuff all the time a lot of times when I shouldn't have been doing that really but you know I was kind of in a learning process there but what's going on here this is really not an ideal way right we don't really want to just hack into the head of our child theme what is maybe like a better way to do this there's one word that starts with a knee anybody know thank you yeah we want to enqueue our CSS and our JavaScript and so this is the kind of stuff that I was just doing all the time because I didn't know WordPress and I didn't really know any better and I'm hoping that there's at least one person who sort of might be in that same ballpark where they might be doing similar stuff so we're definitely going to fix that up and in fact once we enqueue our scripts properly we can actually just get rid of this header dot PHP altogether it really doesn't even need to be in our child theme so that's going to help to sort of clean stuff up a little bit if we take a look real quick at this JavaScript file it's really not doing a whole lot but again I did want to at least use a you know the JavaScript file and sort of make it dependent on jQuery even though if you look at the code well it really doesn't need to be dependent on jQuery you could do it really easily without jQuery as far as how this works again I'm sort of mimicking this functionality so all that my plug-in is going to do here is when you click on one of these instead of going to all these services and finding the right code to sort of make the dialog box pop up to share what I did was I just insert this little text at the bottom sharing is caring and so that's going to just mimic again like popping up like I said I didn't want to remake a social sharing icons plug-in because there's a bunch of good ones out there so that's not really the point essentially what this is is it's going to be mimicking what this functionality is doing so you can just kind of hit that all day and it'll it'll just put a new sharing is caring at the bottom and if we just reload the page should all go away so the first thing I mean really one reason why WordPress has its own in queuing system is if we just kind of take this chunk right here oops and let's say that we are just kind of messing around with where we should put that and we put it above WP head right that's going to cause some problems me just open up my console does anybody know right off the bat what problem is that going to cause okay well let's just see so I want to open up my console here and just reload yeah it's above the head section so what am I getting there jQuery is not defined well what does that mean well basically it just means my JavaScript file which is being loaded right here is trying to use jQuery but jQuery hasn't been loaded by WordPress yet right because it does that on this WP head call so if you you know this this method of like sticking your scripts and your style sheets directly in the head is pretty temperamental because you can put it in the wrong place really easily and again if you're making a plug-in you don't have access to the person's like header dot PHP file you just can't edit that so we really need a way to get our style sheets and our JavaScripts loaded without like hacking in to the header of our parent theme so we're gonna basically handle that in just a second but again this whole dependency on jQuery it's just kind of one of the many things that you'll you'll come up against and that's really it so at this point I guess that's a good review of the child theme we're gonna go ahead and make our plug-in now did anybody have questions at this point as far as how this child theme is set up maybe why some of those things were bad to do anything like that hopefully that all made sense okay so let's just look at how we can actually make a plug-in and if you've never made one before it's probably a lot easier than you think it's going to be okay so I'm going to go back up out of my themes folder for now and into my plugins folder there's nothing in there which is fine if we go over to the site here we can go to plugins and no plugins available though it's just fine there's no plugins in the system yet so I just want to make sure that this error got cleared up once I moved my JavaScript back and I guess I didn't save that or something what follows that then so I neglected to save when I move this back down so what is kind of if I'm making a plug-in does anybody know what's sort of the first thing I should do on my computer if I want to make a plug-in well a good place to start is just go ahead and create a folder right and we want to make it right here in this plugins folder and I'm just going to call this TYCP turn your code into a plug-in dash plug-in example you can call yours anything you want preferably don't use a folder name that is already belonging to a plug-in in the wordpress.org repository and essentially what I need is just like one one file it's really all I need you don't actually even need a folder you just need a file but we're going to make a folder because we're going to have multiple files in our plug-in so here we are in the plug-in folder and all I'm going to do is just make a PHP file with the same name as my folder it doesn't have to be the same name but it's usually a good idea so I'm going to I'm going to create a file and I want to just create a file called TYCP dash plug-in dash example dot PHP and then I'm going to open this guy in text Wrangler 2 so there's only one file in here but we will have more usually when I'm like first starting a plug-in what I'll do is I'll just Google it used to be in the codex actually just this morning though I noticed for the first time I don't know if anybody else has but if you Google like how to make a wordpress plug-in this page right here in the codex has a lot of good info in it I'm about 99% sure that this page used to have like the header that you need to put in your file but literally like just this morning I was looking and it wasn't in there so I'm really glad that I caught that but it's actually let's see it's on one of these and essentially we just there's like a big chunk that we need to copy and paste so what we're really looking for is the header and wordpress gives you this example of like what kind of header could you have in your plug-in so this is really it to make a plug-in it's as easy as having a file and again this is where it's really similar to a child theme you just sort of notice that this whole chunk of code is actually not really doing anything as far as PHP is concerned it's all in a comment right you see like the little slash star at the beginning and end well that's just a comment so we're not really executing any code we're just kind of using wordpress as format that it knows how to read so I'm just going to call this sharing icons plug-in you can literally call it whatever you want this plug-in doesn't have its own web page so I'm not going to fill that out the description ads social sharing icons after post content it's always good to give your users a description so just for the sake of thoroughness I'm going to say on all pages if you're making a plug-in you should really communicate to the user what they can expect and so they might see that and say well I don't want it on all pages I want to go find another one you're kind of doing them a service because they don't have to take the time to install your plug-in check it out see if it does what they want and move on so use that description to kind of tell them what they can expect version I'm not really sure if you even have to have that I don't think that you do but all this stuff I'm filling out most of its optional some people are probably gonna fuss at me for removing these two these are what handles like the translation stuff into different languages but I'm essentially for now just going to ignore those because it's not really even a real sharing plug-in but this is where the cool part comes in so just doing that which is essentially doing nothing in a sense there's no PHP code being executed it's just a comment I can then go to my plugins page and reload and all of sudden hey I have a plug-in so it really is just that easy you put a little block of comments in a folder or in just a file put that file or folder inside your WP content slash plugins folder and you've got a plug-in so that's pretty cool and you can go ahead and activate it it's not really again it's literally doing nothing so this is kind of like the most basic plug-in you can have it's like the Seinfeld of plug-ins right plug-in that does nothing so let's go ahead and make it do something I'm gonna go ahead and copy essentially copy this stuff and at this point I guess I'll go ahead and not just copy but I'm gonna cut this out of the functions file okay so if you're curious about what that code is doing like by all means ask me about it after I know it it can sometimes be hard to read on the screen so again you can clone all that this examples from github or just ask me after so there's all the code that's doing the icons so again here's and I want to this is where it does become important I just moved this from a child theme to a plug-in right so this is no longer something that's I can really consider just on my site now it's potentially on anybody's site that has this plug-in and that's important so why do we put these to ICP underscore right if I were writing 30 functions for this plug-in I'd put that in front of every single one of them I used to think that that was kind of dumb when I would see that on forum posts until I understood why you do that so why do we do that anybody yeah if you define if you define a function twice then PHP just decides it's gonna give up usually I guess depending on your PHP version but like let's say that we just to show you an example it's well first of all let's make sure that this is gonna let us know and it didn't like that so let's see did I I might have forgotten to save that functions file see what that says I think it doesn't like the fact that this file let's actually go ahead and just remove that functions so I'm just gonna take my functions dot PHP out I think what it didn't like was the fact that there was just a PHP tag and no white space after that I can kill your site so I just removed if we look at my child theme on the left there's no functions file anymore so if I reload this hopefully it'll come back and it does so at this point I guess just to kind of demonstrate a proof of concept here why do we need this underscore I mean TYCP underscore that probably is the most important thing to do when you're making a plug-in because if if you make a plug-in and another plug-in developer has their plug-in and you call a function the same name then the entire WordPress site is just gonna be white screen it just dies so that's why you'll always see these little like underscore prefixes on all these plug-in functions and just to kind of prove that what's a WordPress function anybody just name a WordPress function so let's try to create a function called get posts and let's just not really have it do anything but it'll just be a function does nothing yeah so it doesn't like that I tried to redefine an existing function and it said no you function with the same name I'm just gonna give up and not do anything so that's why we always have to use these little underscore with our function names I guess I go ahead and get rid of this here so really I guess if I reload the front end I'd be curious to kind of see what what it looks like since part of our functionality is now on the child theme and part of it is in the plug-in all right so I'll see if that breaks anything no it doesn't really have a problem with that of course if this was any other site than mine it would look weird because you'll be missing stuff but let's go ahead and kind of just yank out all this stuff and by the way you you see that prefix everywhere like I've got a div called TYCP-share-links and you know I'm really careful to add that prefix almost everywhere because in my plug-in if I make a div that's just called share-links well maybe someone else also has that div and their plug-in and then I could define styles for mine which would also inadvertently change styling on the other div with the same name so I guess I can't really say it enough just to kind of like when in doubt put that prefix everywhere you possibly can so what I'm going to do now is I cut those styles out of the style sheet and I want to paste them into my plug-in somewhere let's see so if I go back here and here so here's my plug-in folder again it's pretty basic so I'm going to do is I want to make a directory called CSS and I'm going to make a directory called JavaScript or just JS so that created two directories and inside my CSS again probably not necessary but just kind of getting the habit of using initials and you end up putting them everywhere so if we go back into our text editor now we'll see this CSS file and I'm just going to dump my my CSS in there and save at this point we should see some stuff broken yeah so that's kind of like what the ordered list looks like without any styling so why is there no styling I moved it from the style sheet and my theme to my plug-in but it's still it's not getting loaded right so I actually need to within my plug-in I need to say hey I created this style sheet go ahead and load that style sheet so if you're not familiar with the NQ process for WordPress there is an action called WP NQ scripts and what that does it basically allows you to hook into this process and do your own stuff whenever this whenever WordPress calls the the process there so it's this is going to fire on the front end on every page load and what I can tell it to do with my second argument is just to call a function that I'm going to define and I'm going to call it TYCP underscore NQ right so this is kind of like the NQ function for my plug-in and what I'm going to tell it to do first is to NQ a style and I have to give it sort of like a handle so I'm just going to say something real basic and then the next thing I have to do is to tell it basically where can this file be found and again this is where it's tougher to do when you're trying to generalize things but if we look in the child theme right this was like the bad way to load our style sheet and let's see oh actually it was it was in this style CSS file but what I can do and this is going to be bad so just watch and see if you can tell me why this is bad so the URL for my style sheet is slash WP content slash plug-ins slash turn your code into a plug-in example slash all right that's a lot of typing but literally like that will work it's not a good idea but it will work as long as all my typing was correct so let's see if that did the trick nope it says it didn't work I forgot the CSS folder alright so while this is loading why is it a bad idea to put that absolute path or it really wasn't absolute but why is it to put that explicit path in there like I mean it probably will work on some sites it's not going to work on all have you ever seen a site that's like installed in a sub directory so you have like dot com slash blog slash whatever well on those kind of sites this isn't going to work because look how we're calling this path it starts with slash WP content so that'll go to the root and then slash WP content so this is where we get to a difficult case really if you're not familiar with it like how do we account for that how do we tell it hey no matter what the folder is just kind of go to plug-ins directory there and so I kind of have a little cheat sheet here that I do I have this command called plug paths that means nothing to you I'm aware I made it up myself but I basically am going to pass in my my prefix TYCP and hit enter and I'm actually just gonna paste this so it pasted it to my clipboard hopefully oops I actually wanted to copy not paste so when I get basically whenever I first create a plug-in I always add these two functions at the bottom and what this is doing is I'm defining a function this just my initials underscore URL and that's going to always return me the URL of my plug-in folder no matter what subfolder I'm in I can always call this and I know that I have the URL of my plug-in and that's extremely helpful because it lets you get around sub directory installations and all kinds of other stuff if you want to know about what this is actually doing you can ask later I'm not sure if we're going to have time to go too deep into those but the point is when you're in the world of plugins again it's tougher right took 3,000 years to generalize the one triangle example it can take a long time to generalize stuff with PHP and WordPress as well so at this point I can just call the URL function and say hey give me the URL but also append not WP content basically inside my plug-in folder and I'm just going to say slash CSS and then my file name so notice I'm kind of skating around that that issue here like I don't have to say slash WP content I can just define a function that gives me that and use it anytime I want so if I reload that's going to be fine so as far as the JavaScript if we look back into this header dot PHP which was not ideal right we have this JavaScript file which is dependent on J query we saw that it broke if we moved it up here so we're basically going to take that same concept and actually I'm going to enqueue also this font awesome CSS file while I'm here and this one doesn't actually need to call my plug-in URL because it's reaching out to CDN so you can just do that and I want to go ahead and get these things all out of the header like so so at this point and again this is a great moment when you're dealing with child themes when you realize like oh hey I don't need the header file in my child theme anymore I can just get rid of it that's always a great thing you're like shedding some stuff that you really didn't need you're kind of losing weight in some sense so at that point you know you can just basically take out the header file and I don't think our JavaScript is going to work any more because that code hasn't been loaded so you can see I'm clicking but I'm not getting the sharing text down there so I guess there's there is a difference here what we're doing here is enqueuing styles there's also a function called in queue script and again you just sort of pass it a handle and you tell it where to find the file right which we haven't created yet so I'm going to go ahead and create that essentially what I'm going to do I guess I could have just copied the whole file but I'm basically going to paste all that stuff into a JavaScript file which now is living in my plug-ins folder and should be getting enqueued using this command here and I am missing one piece there so let's just kind of see what happens it's going to probably work but not really again same issue jQuery is not defined right so we saw that when we were hacking into the header file like we were not really supposed to if you put that script above WP head you get this jQuery error because jQuery haven't been loaded yet so this whole enqueue process is really good as far as you know you can just tell it hey what scripts does this depend on in our case it just depends on jQuery I think you still have to pass it an array so this is basically telling WordPress like hey don't load this file until jQuery is already been in queue and I can make calls to jQuery that way so now if click on it everything's working and if you look at I guess these two folders here here's my plug-in folder which now pretty much everything we had going in that child theme has been moved over right I still have a style.css but it really doesn't have anything other than some header and widget stuff right that's the green text that we were talking about earlier that's fine you wouldn't want to make everybody's h1's green so don't move that into your plug-in so you really have to think about like what kind of stuff are you you know you're basically defining stuff that's going to happen on everyone's site so you got to be a little bit more careful with styles and stuff like that and so then the ultimate test here and we're just about to wrap things up right this should now work if I change themes right theoretically that's the whole point of the talk so I got my fingers crossed I hope you all do too and I'm just going to change themes and see what happens so I have 2014 loaded on here as well let's go ahead and activate that refresh and there it is so thank you yeah so that's for me like when I sort of discovered that process of moving stuff out of your child theme into a plug-in it just sort of opened up this whole bigger world where it's almost like you're working on many different sites at once in a way so at this point I guess does anybody have any questions that's pretty much it for the talk any questions about anything yeah absolutely you see that other questions all right well go ahead yeah that's pretty much exactly what we do we kind of started out that way and just recently we have sort of like registered a couple of them with WordPress.org so yeah it's not an easy process if you're used to get because you have to use the version that was a big hurdle for me it was like a whole different version control system that I had never used before but yeah we have a couple in there now but I guess one of the main points about this talk is like you can just make your own you can host them on GitHub if you want to share them with other people you can host them on BitBucket if you want to be private and then you can have like free private repositories there that's typically what we do if we're working on a plug-in that's like not quite ready for the general public to like see you know everything just usually like put them on BitBucket and just have this internal group of plug-ins yeah anybody else all right thank y'all