最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Child theme dosn't overwrite WooCommerce (version 3.4.7)

matteradmin11PV0评论

I've followed the WooCommerce instructions for child themes including declaring the child theme:

function theme_woocommerce_support() {
    add_theme_support('woocommerce');
}
add_action('after_setup_theme','theme_woocommerce_support');

(/)

I created a directory in my child theme for WooCommerce template files:

\storefront-child\woocommerce\

And I've added the file I want to edit:

\storefront-child\woocommerce\templates\content-product.php

I added a comment to the file so I could have something to look for to see that it's working. The only way I can get anything to show up is to edit the original plugin files.

I've disabled all plugins other than WooCommerce to test. I've reviewed the WooCommerce status report tab, and the child theme is registered, but the child theme WooCommerce templates are not. I've made sure debug mode is disabled.

Any other ideas?

I've followed the WooCommerce instructions for child themes including declaring the child theme:

function theme_woocommerce_support() {
    add_theme_support('woocommerce');
}
add_action('after_setup_theme','theme_woocommerce_support');

(https://docs.woocommerce/document/template-structure/)

I created a directory in my child theme for WooCommerce template files:

\storefront-child\woocommerce\

And I've added the file I want to edit:

\storefront-child\woocommerce\templates\content-product.php

I added a comment to the file so I could have something to look for to see that it's working. The only way I can get anything to show up is to edit the original plugin files.

I've disabled all plugins other than WooCommerce to test. I've reviewed the WooCommerce status report tab, and the child theme is registered, but the child theme WooCommerce templates are not. I've made sure debug mode is disabled.

Any other ideas?

Share Improve this question asked Nov 5, 2018 at 21:49 JuxtraJuxtra 133 bronze badges 1
  • Note: this is WooCommerce version 3.4.7 with Wordpress 4.9.8. The parent theme is Storefront – Juxtra Commented Nov 5, 2018 at 21:51
Add a comment  | 

1 Answer 1

Reset to default 1

Perhaps this post can be helpful.

If not, then here are a couple of other things you can attempt:

Override in parent-theme
You could also (temporarily) try to override the template in the parent-theme, to see if that works.

Double-check uploaded files
I would probably also double-check the files on the remote-host, that the isn't some old file(s) messing with the setup. I don't know about you, but I sometimes just delete files locally and forget to check if they've been uploaded.

Delete template-folder from the remote host and reupload
... You could also try and delete the entire template-folder on the remote host, and then upload a single file (in case some file is cached/corrupt/whatever).

Incognito
Perhaps try in an incognito-tab (in case of cache).

Use die()
In case you try and print something and can't find it, then perhaps try and insert below-written code-snippet in your template, since that makes it obvious if the template is being executed or not.

echo '<p>Do you see me?</p>';
die();
Post a comment

comment list (0)

  1. No comments so far