I'm trying to customise WooCommerce's Shop page (called 'Products' in this instance) to include a template part from my main WordPress theme.
get_template_part() does not work. I believe that's because a plugin can't tell which files will exist in a theme so it's disabled. Alternatively, I wonder if it's because the function is being called from within the plugin directory, so it's looking in the wrong directory.
include() does not work. I get the following errors:
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in ...\woocommerce\archive-product.php on line 52 Warning: include(.../partials/acf-flexible-layout.php): failed to open stream: no suitable wrapper could be found in ...\woocommerce\archive-product.php on line 52 Warning: include(): Failed opening '.../partials/acf-flexible-layout.php' for inclusion (include_path='.;C:\php\pear') in ...\woocommerce\archive-product.php on line 52
note: the three dots (...) in the file paths are a reference to my theme.
Something else to note is that the template part I'm trying to include reference Advanced Custom Fields associated with the Products / Shop page in WordPress.
copying the template part's code directly into the archive-product.php does not work. I'm not sure why this is.
Any help would be much appreciated.
EDIT I have already checked How to include a file using get_template_part() in a plugin? but it doesn't seem suitable:
- The answer chosen gives
include()as a solution. I've already said this doesn't work for me.
- It's not a plugin I'm developing. It's WooCommerce. Any updates to the plugin could delete the files I add / change.
- I don't fully understand the other promising answer given, so I'm not able to adapt it to suit my needs (if that's even possible).