Multisite child theme files sometimes cannot load properly

Hi, I found that my multisite sometimes do not load the child theme files. For example, I have place an edited file in child theme(woocommerce/content-product.php) to show variations info on shop page.

When I check the Shop page, the edited content didn't show and i need to refresh the page several times then the edited content just show. But when I refresh the page again, the page show unedited content again. It seemed like sometimes it load from parent theme and sometimes load from child theme.

Below is the sample link for problem mention above, you can refresh several times to see the different:
http://kent.nexwee.com/shop/

How can I solve this kind of problem?

  • Milan
    • WordPress Wizard

    Hello Calvin Chong

    Hope you are well today and thanks for asking us. :slight_smile:

    As WooCommerce defines fall back template in its own directory, we can do little trick here. :slight_smile:

    Just take backup of your product template( product.php file ) of parent theme and then delete it. As you have defined edited template in your child theme, WooCommerce should now load product template from child theme only !!

    Let me know how it goes. :slight_smile:
    Cheers,
    Milan

  • Milan
    • WordPress Wizard

    Hello again Calvin Chong

    Hope you are well today. :slight_smile:

    Actually there is one trick we can try here. But its not quite WordPress standard of doing thing but it may solve your this issue. :slight_smile:

    First of all we'll need id of subsite where this issue is taking place. You can find it by hovering "edit" link of sites in site listing over your network. Please take a look at this screenshot.

    Once you have id of affected subsite, open product.php file of your parent theme, and add these lines to the beginning of file.

    $blog_id = get_current_blog_id();
    
    if( $blog_id == 'YOUR_SUBSITE_ID' ){
    	require_once 'PATH_TO_YOUR_CHILD_THEME_product.php_FILE';
    	exit;
    }

    Let me know how this goes. :slight_smile:
    Cheers,
    Milan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.