WooCommerce – get_template_part ?
-
Just trying to figure out here is WooCommerce blocking all default WordPress include tags form their templates?
Like get_template_part(); that’s a default WordPress function.
What if I have overridden a WooCommerce template just like the Woo. documentation says, copy X template into your ‘woo commerce’ theme folder.
Works great and nothing special almost every better plugin does this trick but what if I want to include a custom file.php into that overridden WooCommerce template file which is mine now because it’s in MY theme folder so it belongs to me not WooCommerce.I have this feeling WooCommerce is blocking those pretty default WordPress include tags the WP Codex offers.
If I do this I get no results returned:
<?php get_template_part( 'includes/woo/my-file.php' ); ?>Inside that ‘my-file.php’ there is only a echo ‘hello world’; to test and see if it gets included but nothing will come up.
If I do this in my functions.php it works.
function include_my_file() { require get_template_directory() . '/includes/woo/my-file.php'; }and then in my woo. overridden template file I simply include the function <?php include_my_file(); ?>
Why does it do this ?
The topic ‘WooCommerce – get_template_part ?’ is closed to new replies.