admin管理员组文章数量:1418064
The functions.php
file of my Child Theme is a mess...
I'd like to use classes in a separate folder (like /inc) but I would like to keep a maximum of security.
For now everything works as excepted, but is my code safe enough to use in production ?
functions.php
// Include our classes. require_once( get_stylesheet_directory() . '/inc/class.my-class-1.php' ); require_once( get_stylesheet_directory() . '/inc/class.my-class-2.php' ); ... // Instantiate our classes. $my_class_1 = new My_Class_1(); $my_class_2 = new My_Class_2(); // Hooks goes here. add_action( 'hook_i_want', array( $my_class_1, 'my_function_in_class_1'), 10 ); add_filter( 'other_hook_i_want', array( $my_class_2, 'my_function_in_class_2' ) ); ...
Or maybe a better idea ?
本文标签: Child themehow to cut the functionsphp file into several classes
版权声明:本文标题:Child theme, how to cut the functions.php file into several classes? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745248274a2649663.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论