moxie-leean / loader
This package is abandoned and no longer maintained.
The author suggests using the moxie-lean/loader package instead.
Loader for files in wordpress making things easier instead of using a require
0.2.0
2016-03-08 18:38 UTC
Requires
- php: >=5.4.0
- moxie-leean/theme-assets: dev-master
Requires (Dev)
- squizlabs/php_codesniffer: 2.*
- wp-coding-standards/wpcs: dev-master
This package is auto-updated.
Last update: 2022-02-01 12:56:15 UTC
README
Allows to load files from directories with a more sugared syntax, and allowing the use of params passed to the fils.
Register directories where to look for file.
add_filter( 'loader_directories', function( $directories ){ $directories[] = get_template_directory(); return $directories; });
That will search files on the root directory of your theme.
Register alias
The alias are used to search inside of directories more easily for example:
add_filter('loader_alias', function( $alias ){ $alias['partial'] = 'partials'; return $alias; });
Which give us a sintax like this:
Load::partial( 'button' );
From a file located in:
get_template_directory() . '/partials/button.php'
,