Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook best practices #2821

Open
jonathanbossenger opened this issue Aug 3, 2024 · 14 comments
Open

Hook best practices #2821

jonathanbossenger opened this issue Aug 3, 2024 · 14 comments
Assignees

Comments

@jonathanbossenger
Copy link
Collaborator

No description provided.

@jonathanbossenger
Copy link
Collaborator Author

From a disucssion on #2700, this is a new lesson with some additional notes on working with hooks. A better title also needs to be decided.

@MichelleBlanchette
Copy link

Ideas that come to mind for this lesson:
• Always use a named callback rather than anonymous functions (aka lambdas) to help with debugging (ie stack traces) and the ability to remove the hook easily.
• When creating custom hooks, try to keep the passed parameters and their order the same in all areas the hook (same name) is used.
• How to properly document custom hooks per WordPress's documentation standards.
• Suggest naming conventions for custom hooks..? I'm not sure there are any and this might just be up to personal preference.
• The recommended hooks for common needs, such as enqueueing scripts and styles..? This might be in the weeds as it varies heavily per project. Also, other lessons likely dive into these concepts more thoroughly.

@jonathanbossenger Did you have ideas in mind for this lesson? I'm wondering if there's enough to say to justify this lesson, but maybe it's simply going to be a shorter lesson... I could just be missing the idea here. 🤔

@jonathanbossenger
Copy link
Collaborator Author

Shorter lessons are also perfectly fine 😁 We typically aim for lessons that can be watched in around 5-10 minutes. Sometimes they do go longer if we need to a deeper dive into a topic.

@jonathanbossenger
Copy link
Collaborator Author

jonathanbossenger commented Oct 1, 2024

@CrochetFeve0251 I wanted to check if you are still interested in drafting a script for this lesson?

If you are, I will make sure to get the description and learning outcomes updated tomorrow.

I'll also be reviewing your script for #2702 this week.

@CrochetFeve0251
Copy link

@CrochetFeve0251 I wanted to check if you are still interested in drafting a script for this lesson. I'll be reviewing your script for #2702 this week.

@jonathanbossenger I am at the retreat from my company so it is hard to contribute before I had a WC so I didn't advance much last weeks.

I'm gonna make that script next week.

@jonathanbossenger
Copy link
Collaborator Author

@CrochetFeve0251, next week is perfectly fine, as it gives me time to get things updated here.

Enjoy your company retreat! 😃

@github-project-automation github-project-automation bot moved this to 👋 Ready to Create in LearnWP Content - Development Oct 18, 2024
@kaitohm kaitohm moved this from 👋 Ready to Create to 🚧 Drafts in Progress in LearnWP Content - Development Oct 18, 2024
@CrochetFeve0251 CrochetFeve0251 self-assigned this Oct 20, 2024
@CrochetFeve0251
Copy link

Here is a link to the script: wptrainingteam/learn-wp-content#13

@jonathanbossenger jonathanbossenger self-assigned this Oct 21, 2024
@jonathanbossenger
Copy link
Collaborator Author

Thanks, I have left my first review comments.

@jonathanbossenger
Copy link
Collaborator Author

@jonathanbossenger jonathanbossenger moved this from 🚧 Drafts in Progress to 🔎 Ready for Review in LearnWP Content - Development Nov 7, 2024
@MichelleBlanchette
Copy link

Video for review: https://drive.google.com/file/d/1gA-bUge1AwXfIdqA9BmVIV7YohffsONw/view?usp=drive_link

@jonathanbossenger I'm unable to access this one for review as well.

@jonathanbossenger
Copy link
Collaborator Author

@MichelleBlanchette apologies, this should be public now.

@MichelleBlanchette
Copy link

Tutorial/Lessons Review Checklist

Please tick all items you've confirmed:

  • Learning outcomes/objectives are clear.
  • Technical concepts introduced in the content are accurate.
  • The speed of demonstrations are easy to follow.
  • The narration audio matches what is shown visually.
  • Spelling and grammar are correct.
  • 0:27 Mistake "... consider using a the name of..." in the slide
  • Sound quality is consistent throughout the video.
  • Brand Usage Guidelines and Promotional Guidelines are being followed.
  • Media assets are all in the public domain (CC0).

Really great insights. 😃 I was intrigued by the mentioning of current_filter() and current_action() functions. I know what you mean about a function being used for multiple hooks—good stuff!

@jonathanbossenger
Copy link
Collaborator Author

0:27 Mistake "... consider using a the name of..." in the slide

Thanks, I'll make sure to get this fixed before publishing.

@jonathanbossenger jonathanbossenger moved this from 🔎 Ready for Review to ✅ Preparing to Publish in LearnWP Content - Development Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Preparing to Publish
Development

No branches or pull requests

3 participants