Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRifqi Fahmi
23,164 Pointswhat is handler ??
I have been studying PHP dev for a while. But I still confused what is 'handler' mean in PHP function?? Such as in this video, Zac make the handler is 'foundationd_css' . Can i type whatever handler name which i want ?? is there can someone elaborate what it mean ??
wp_enqueue_style('foundation_css', get_template_directory_uri(). '/css/foundation.css' );
Thanks :)
1 Answer
Kevin Korte
28,149 PointsYes, this is a custom function written in wordpress. You won't fine "handler" in regular php documentation since it's it's really just an argument to the wp_enqueue_style
function defined in the wordpress ecosystem.
Handler can be any valid string. You get to decide.
https://codex.wordpress.org/Function_Reference/wp_enqueue_style
Rifqi Fahmi
23,164 PointsRifqi Fahmi
23,164 Pointsso handle just a reference of an object or to give a name to that object just like identifier ??
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsBasically. If you look at the example below on the link I provided, in the Load stylesheet only on a plugin's options page example you can see they use
wp_register_style
with a handler, and than later they just callwp_enqueue_style
with only the same handler name as an argument, and it works.