PHP code structure
Details
- Content type (Online Workshop, Lesson, Course, Tutorial, or Lesson Plan): Lesson
- Content title: PHP code structure
- Topic description: A very simplified introduction to using PHP classes to structure code.
- Audience (User, Developer, Designer, Contributor, etc.): Developer
- Experience Level (Beginner, Intermediate, Advanced, Any): Intermediate
Prerequisites
It is assumed that the learner has already completed the following lessons:
- Beginner WordPress developer
- Modules 1 - 4
- Module 6: An introduction to developing WordPress plugins
Learning Objectives
- Identify different ways to structure PHP using classes
- Explain the difference between creating an instance of a class and using static class methods
Related Resources and Other Notes
Automation Code
//lesson
Lesson Development Checklist
- [x] Gather any relevant links to Support, Docs, or related material
- [x] Description and Objectives finalized
- [ ] Lesson created and announced to the team for review
- [ ] Lesson reviewed
- [ ] Lesson video submitted and published to WPTV
- [ ] Lesson created on Learn.WordPress.org
- [ ] Lesson video published to YouTube
- [ ] Lesson on Learn.WordPress.org updated with YouTube video
- [ ] Lesson published to Learn.WordPress.org
Script for review:
https://github.com/jonathanbossenger/wp-content/blob/main/plugin-developer-learning-pathway/01-Plugin-Development-Practices/01-php-code-structure.md
Audio file: https://drive.google.com/file/d/18L8m-wZIzuBCfuggzNN-25CQz0t17BTi/view?usp=sharing
@agiljulio this lesson is ready for you to start creating.
hi @jonathanbossenger thank you for the audio and script. I will start working on it as soon as I finish the module from Wes π
Thanks @agiljulio are you able to make an educated guess as to when this might be, just to help my planning. Thanks
Hi, @agiljulio, I just wanted to check in with you. Are you able to share an ETA for this video?
hi @jonathanbossenger I will aim to finish it by this week and will do my best to have it completed by Friday, as we are currently focusing on our OKRs this week π
100% thanks for the update.
Hi @jonathanbossenger , hereβs the video. Apologies for the delay π Also, could you please send the thumbnail for this video? I need it to be included in the intro. And please have a look and feel free to share any feedback, thank you π
Hi @jonathanbossenger , hereβs the video. Apologies for the delay π
No worries at all, I know you were busy with your OKRs π
Also, could you please send the thumbnail for this video? I need it to be included in the intro.
I usually only create the video thumbnails once all the videos on a module are completed, and then I upload them to WordPress.tv and YouTube when I upload the videos. I do this because I try and pick a single "theme color" for all thumbnails in a module. Does that process work for you?
And please have a look and feel free to share any feedback, thank you π
I will do, thank you. In the meantime, there's another script/audio file ready for you π
Yes, that works for me. Previously, in Wes' module, I used the thumbnail in the video intro and it seemed to work really well π
Thank you, will work on it for the next video π
:smile: Wes is better than me at creating thumbnails early on. If you prefer I can create the thumbnails next week?
sure, take your time, no need to rush π
Video is ready for review.
Script: https://github.com/jonathanbossenger/wp-content/blob/main/plugin-developer-learning-pathway/01-Plugin-Development-Practices/01-php-code-structure.md
Video: https://drive.google.com/file/d/1aamHKSG8Gk_k09rIpvdO3S_kTMAjmO3F/view?usp=sharing
Guidelines for reviewing content: https://make.wordpress.org/training/handbook/training-team-how-to-guides/guidelines-for-reviewing-content-on-learn/
Tutorial/Lessons Review Checklist
Please tick all items you've confirmed:
- [x] Learning outcomes/objectives are clear.
- [x] Technical concepts introduced in the content are accurate.
- [x] The speed of demonstrations are easy to follow.
- [x] The narration audio matches what is shown visually.
- [x] Spelling and grammar are correct.
- [x] Sound quality is consistent throughout the video.
- [x] Brand Usage Guidelines and Promotional Guidelines are being followed.
- [x] Media assets are all in the public domain (CC0).
@agiljulio, another great video, thank you.
I have some feedback regarding the highlighting of specific blocks of code, making sure that the correct code is highlighted in certain places.
- [ ] 0:29: please highlight the code of the body (with class="main"), as this is where PHP is used to output the book info
- [ ] 1:10: please highlight the
get_title,get_author,get_publishermethods of the class, not the__constructmethod - [ ] 1:15: please highlight line 25
- [ ] 1:23: please highlight the
__constructmethod - [ ] 1:31: please highlight the object method calls in the HTML (e.g. $book->get_title() etc.)
- [ ] 2:10: Here, please switch back to the code using non static methods at 0:53 and show the -> being used in the HTML output, Then it can switch back at around 2:20 and show the :: usage for static methods. Please highlight those usages in the HTML output, not in the class.
Please let me know if you have any questions on the above changes.
Thanks
hi @jonathanbossenger thank you for your feedback and here is the updated video, thank you π
Thanks @agiljulio
I'll leave this issue open until the end of next week, for anyone else who wants to review.
Thanks @agiljulio I've opened the lesson up for the rest of the training team to review.
Tutorial/Lessons Review Checklist
Please tick all items you've confirmed:
- [x] Learning outcomes/objectives are clear.
- [x] Technical concepts introduced in the content are accurate.
- [x] The speed of demonstrations are easy to follow.
- [x] The narration audio matches what is shown visually.
- [x] Spelling and grammar are correct.
- [x] Sound quality is consistent throughout the video.
- [x] Brand Usage Guidelines and Promotional Guidelines are being followed.
- [x] Media assets are all in the public domain (CC0).
I just watched this video over a few times and it's really well put together. Clear and to the point without being complicated, and done at a great pace.
Tutorial/Lessons Review Checklist
Please tick all items you've confirmed:
- [x] Learning outcomes/objectives are clear.
- [x] Technical concepts introduced in the content are accurate.
- [x] The speed of demonstrations are easy to follow.
- [x] The narration audio matches what is shown visually.
- [x] Spelling and grammar are correct.
- [x] Sound quality is consistent throughout the video.
- [x] Brand Usage Guidelines and Promotional Guidelines are being followed.
- [x] Media assets are all in the public domain (CC0).
Really enjoyed this lesson! The audio is clear, the pace is easy to follow, and I especially enjoyed the animated elements pointing out the relevant code blocks/lines being discussed.
@agiljulio I am going to prepare this to be published this week. I will upload the thumbnail here for you tomorrow.