Wordpress - When is get_template_part() preferable to simply using the template.php files?
A recommended approach for using get_template_part
would be for including bits of code that would otherwise be repeated frequently in all your templates. Like if you had conditionals defined within your loop that you wanted to include in archive.php, search.php, single.php etc.
It also allows child themes to override that file and include additional more specific files. For example if you used get_template_part( 'loop', 'single' )
and your theme only has a file named loop.php then a child theme could include a file named loop-single.php that would override your loop.php.
It's basically a custom includes tag for template files other than header, sidebar, or footer.
I don't feel like there is ever a valid reason NOT to use get_template part. Before it existed, WordPress themes were filled with repeated code and were very time-consuming + confusing to make larger modifications. Having one loop file that is always used to display posts is a godsend both for child themes and those who wish to "fork" themes. If you look at the code for the Twenty Eleven theme (currently in development) you will see that template parts have been extended into post formats as well. You will also notice that "The Loop" has been removed from the template and placed in the calling template. I think this is the best ways to use template parts for post content and is much more flexible than Twenty Ten.
Did you know that other template behave almost identically to get_template_part()?
IMHO the more flexible a parent theme is the better!