Can we use include(locate_template('...')) to include templates?

I browsed forums but most answers on this are vague.
Can someone please advise if we can use this

include(locate_template('template_name.php'));

to include template parts.
Any help is appreciated!

Could someone please give us a hint. Thank you!

Wordpress? Why donā€™t you use get_template_part?

1 Like

No you canā€™t use that in WP themes.

you must use get_template_part()
here is why http://buildwpyourself.com/get-template-part/

I need to pass variable to templates and none of the default wp ways allow it.

locate_template() is perfectly fine to be used, also per submission requirements;

If incorporated into the theme, custom template ļ¬les are required to be called using get_template_part() or locate_template()

but what I am asking about is the combo of include and locate_template() which I also found in several TF WP themes.

1 Like

Hey @Themezly, were you able to get your theme approved with include(locate_template())?