get_template_part
get_template_part
will do the job better, while giving extra flexibility. For example:custom-loop.php
. If the file does not exist, it will load custom.php
, and if a child theme exists, it will load the child theme version of the file.loop.php
, but if a custom version of the template exists for that post type, it will load that instead. e.g. loop-page.php
get_template_part
uses the locate_template
function. This function finds the appropriate file, and returns its name. This is useful for finding a template, without loading it.template_include
filter. Scroll down for a more in depth look at the template_include
filter.functions.php
is a file in your theme that gets loaded prior to any templates. If your theme has non-template functionality, such as changing the length of excerpts, adding stylesheets and scripts, etc, this is where that code would go.functions.php
and plugin development. However, there is a difference in how it's loaded.template_include
filter