WordPress.org

Ready to get started?Download WordPress

Forums

File in Child Theme is not overriding Parent Theme file? (6 posts)

  1. sparklogix
    Member
    Posted 1 year ago #

    I have a custom theme that uses WooCommerce. I'm trying to override some WooCommerce functionality/styling in the Child theme but the file doesn't appear to be working.

    I have the file in this directory: /childtheme/woocommerce/theme-woo.php

    I have this in my child theme functions.php file:

    /* This file is for overrides on the woocommerce templates */
    if (class_exists('Woocommerce')) {
    	include_once( TEMPLATEPATH . '/woocommerce/theme-woo.php' );
    }

    The stuff I have changed in the theme-woo.php file is not showing up at all on the site. Am I doing something wrong? I have added another WooCommerce file (content-single-product.php) in the /childtheme/woocommerce directory without having to link to it in the functions.php file, and it works just fine. Am I missing something?

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Have you looked at the CSS specificity and/or other CSS problems?

    Firebug and/or validating the CSS should be helpful in identifying what's going on.

  3. sparklogix
    Member
    Posted 1 year ago #

    I'm trying to change a class name from span9 to span12 and it's not changing on the page. I've checked in Firebug and it doesn't change at all. I changed the class name in the parent theme file and it works, but I don't want to modify the parent theme.

  4. cliffsun91
    Member
    Posted 12 months ago #

    I'm having this exact same problem, I believe it could be because your theme-woo.php file is not a template file, and only template files get overriden automatically in a child theme. I assume that content-single-product.php is a template file which is why it gets overriden.

    I hope theres a way to be able to override other files, I don't know how but I wonder if you've managed to solve your problem?

    Edit: One of the problems I'm having is that the parent theme's function.php includes all the files it needs, but I assume that it includes the file from its parent theme directory. What would be useful is to be able to not include those but include the files from the child theme. I don't think its possible to un-include a file though later on...

  5. WPyogi
    Volunteer Moderator
    Posted 12 months ago #

    @cliffsun91 - please start your own thread per:
    http://codex.wordpress.org/Forum_Welcome#Where_To_Post

  6. gian-ava
    Member
    Posted 4 months ago #

    I got the same problem, with a theme that uses a file in the parent theme: /framework/meta-boxes.php

    I am trying to make some customisation reproducing the same structure in the child theme, but it doesn't work.

    Do you guys worked out the solution?

Topic Closed

This topic has been closed to new replies.

About this Topic