get_template_part() is a specific wrapper for locate_template().<div><br></div><div>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 code/function files.</div>
<div><br></div><div>I would also generally say that code/function files should be included in functions.php, rather than being dumped into template files.</div><div><br></div><div>Chip<br><br><div class="gmail_quote">On Fri, Apr 22, 2011 at 12:01 PM, Towfiq I. <span dir="ltr"><<a href="mailto:tislam100@gmail.com">tislam100@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br><br>So if we want to load a file from a sub-directory(for example "mytheme/lib/my_codes.php") we can use this:<br>
<br><div><?php locate_template( array( '/lib/my_codes.php' ), 1); ?><br><br>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 <a href="http://codex.wordpress.org/Function_Reference/get_template_part" target="_blank">http://codex.wordpress.org/Function_Reference/get_template_part</a><br>
</div><br>Thanks.<br clear="all"><br>-- <br><font color="#888888"><span style="color:rgb(153, 153, 153)">Towfiq I.</span><br><br>
</font><br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div>