WordPress WordPress Theme Development Working with CSS and JS in WordPress Themes Adding CSS to a Theme Via the functions.php File

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

what 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
Kevin Korte
28,078 Points

Yes, 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
Rifqi Fahmi
23,164 Points

so handle just a reference of an object or to give a name to that object just like identifier ??

Kevin Korte
Kevin Korte
28,078 Points

Basically. 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 call wp_enqueue_style with only the same handler name as an argument, and it works.