This entry is part 2 of 7 in the Writing Your First WordPress Plugins, Basic to Advanced Series
- How to Begin Writing Your First WordPress plugin
- Structuring Your First WordPress Plugin
- Writing Your First WordPress Plugin Part 3
- Writing Your First WordPress Plugin Part 4
- Writing Your First WordPress Plugin Part 5
- Writing Your First WordPress Plugin Part 6
- Writing Your First WordPress Plugin Part 7 – Final
Knowing how to best structure your plugin is very, very important to the success and quality of your plugin. You should spend several minutes laying out the structure of your plugin before you ever begin writing it. This part of the Writing Your First WordPress Plugin series will walk you through the process of laying out your plugin structure. I will also describe many of the best practices you should be using while developing your plugin.
Notes From The Video
Your plugin folder/file structure should look similar to this:
- Always prefix your function and variable names
- Separate your plugin into multiple files with filenames that make logical sense
- Always give your WordPress plugin its own dedicated folder
- Name the plugin folder and main file the same thing
- Comment your code
- Group similar functions together
You can download the work-in-progress plugin below. You will be able to download the full version with everything I have done at the end of each part in this series.
The download for this plugin has been lost. Please proceed to part two and download the WIP plugin there.
31 thoughts so far
Have your say
Great start and good explanations of all the important things.
Looking forward to the rest of series.
This is a great way for me to learn the basics. Thanks again!!
Thanks Pippin. I’m following along so far. I don’t really know php (very very little anyway) but appreciate this tutorial series. 🙂
@Scott – glad you like it so far. If you follow it through to the end, you should have a much better understanding of php (in some way or other). More coming soon 🙂
Cheers Pippin! Great tutorial series mate!
I’m studying php now and I’m able to do simple functions/if-else statements when customizing my theme etc. but your plugin series is helping so much. I really do think knowing some php as well as WP Codex is going to help not only create plugins (eventually) but also with customizing themes, or creating them.
Lots to learn and I’ll keep checking your site for more great info.
Have a question about your tutorial on adding farbtastic to widgets but I think I’ll post/comment on that post.
Thanks again for the work you do!
Glad you like it and thanks for following!
I started following this series, It seems great! I will start making my first plugin soon.
I have a question about making the files in folders and making comments. my question: isn’t this going to make the site load too much files and also make the files bigger in size when we fill them with comments. Don’t we have to think about the loading time of the site?
@mohalam – Technically, yes, adding extra folders and filling the files with comments will make the plugin larger, but the impact you will see will be so utterly minimal that you do not need to worry about it. The advantage you will see by structuring your plugins well and leaving extensive comments will greatly outweigh the increased size.
I can see your point!
I’m really enjoying this series. I just found it and I have been wanting to jump into plugin development for sometime now. I’ve been coding themes for over the past year. This is a great way for me to learn the basics. Thanks again!!
there is an error,”The requested URL /embed/GTvwql7KH3M was not found on this server.”
Where are you seeing that error?
Thank you so much for this tutorial
“Download WIP Plugin” links to a 404.
Please go on to part two and download the WIP plugin there.
Your plugin tutorials are the best I have ever seen. Nobody else has a comparable structure and makes things so clear as you do. Thank you very much for sharing your outstanding work 🙂
Glad to hear you find them helpful!
thanks , i get start now
where is the video?
It should be showing above. If it doesn’t, here’s a direct link: https://www.youtube.com/watch?v=GTvwql7KH3M
Only discovered the website now…Loving it!! Good tutorial!
Great video Tnks
i watched so many videos and documentations on plugin developement but i think this is the best one..
Glad to hear you liked it!
Hi Pippin, very good tutorial.
I managed to get everything done except the settings won’t save on the admin-page. Any idea what could be the cause of this?
Also where can we download your plugin files, you mention we can download them but i dont see them.
If you post your plugin to snippi.com and then share the link, I can take a look at it to see if I can identify what the issue is.
You can download the WIP plugin on the next section: https://pippinsplugins.com/writing-your-first-wordpress-plugin-part-3/
Amazing introductory plugin series! This helped a lot. Thanks!
i haveing a problem qith the toturial basicaly is not saving the data. can you help?
Thanks Pippin! That’s an awesome way to organise the plugin. Sorta like how we do Rails and MVC 🙂
thank you pippin! this is realy helpfull for my basic skills
Comments are closed.
Leave a reply
Join the discussion