[theme-reviewers] get_template_part vs locate_template
chip at chipbennett.net
Fri Apr 22 17:04:31 UTC 2011
get_template_part() is a specific wrapper for locate_template().
I would generally say that the former function is preferred, unless it
cannot be used. Also note that *both* of these functions are primarily
intended for including *template* files - i.e. markup files, rather than
I would also generally say that code/function files should be included in
functions.php, rather than being dumped into template files.
On Fri, Apr 22, 2011 at 12:01 PM, Towfiq I. <tislam100 at gmail.com> wrote:
> So if we want to load a file from a sub-directory(for example
> "mytheme/lib/my_codes.php") we can use this:
> <?php locate_template( array( '/lib/my_codes.php' ), 1); ?>
> IF it works and if it is advised, then I gotta say it will be a huge
> relief. I always wondered how to load files that are located in
> sub-directory of the theme folder. Didn't know it can be done with
> get_template_part() hook since it is not mentioned in
> Towfiq I.
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the theme-reviewers