[theme-reviewers] get_template_part vs locate_template
Justin Tadlock
justin at justintadlock.com
Sat Apr 23 16:58:35 UTC 2011
I wrote an extensive post that covers this:
http://justintadlock.com/archives/2010/11/17/how-to-load-files-within-wordpress-themes
Your code would actually look like this (no slash in front of "lib"):
<?php locate_template( array( 'lib/my_codes.php' ), true ); ?>
On 4/22/2011 12:01 PM, Towfiq I. 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
> http://codex.wordpress.org/Function_Reference/get_template_part
>
> Thanks.
>
> --
> Towfiq I.
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110423/90439c85/attachment.htm>
More information about the theme-reviewers
mailing list