Child Theme - by Chad Leonard - on WordPress WooCommerce support

This topic has 14 replies, 4 voices, and was last updated 7 years, 11 months ago ago by Jack Richardson

  • Avatar: moderninfluence
    Chad Leonard
    Participant
    April 26, 2016 at 18:38

    I always create child themes for my websites but after activation of this child theme I have had some trouble with the subdirectory files within the child theme.

    I thought that I may have made an error on my end, but I was able to run a few tests by making a few changes to the header.php file, uploading it to the child theme, and the changes overwrote the parent theme just fine.

    I have uploaded the following files to the child theme, but they do not overwrite the parent theme files. –

    /wp-content/themes/legenda-child/framework/woo.php
    /wp-content/themes/legenda-child/images/label-new.png

    With that said, I believe the child theme is functioning properly; however, I’m not sure why the subdirectory files are unable to overwrite the parent theme.

    Do you mind taking a look?

    Please, contact administrator
    for this information.
    13 Answers
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    April 26, 2016 at 18:44

    Hello,

    You should copy function code of the changes made in framework directory and paste it into child functions.php file.
    Please try it.

    Best regards,
    Jack Richardson.

    Avatar: moderninfluence
    Chad Leonard
    Participant
    April 26, 2016 at 18:47

    Will you give me an example of that using these files?

    /wp-content/themes/legenda-child/framework/woo.php
    /wp-content/themes/legenda-child/images/label-new.png

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    April 26, 2016 at 19:54

    Hello,

    Please specify what changes you’ve made in the file legenda-child/framework/woo.php.

    Best regards,
    Jack Richardson.

    Avatar: moderninfluence
    Chad Leonard
    Participant
    April 26, 2016 at 20:58

    I removed the total price of everything that’s in the user’s cart by removing this code.

    <span class=”for-label”><?php _e(‘for’, ETHEME_DOMAIN) ?></span> <span class=”price-summ”><?php echo $woocommerce->cart->get_cart_subtotal(); ?></span>

    From this section.

    if(!function_exists(‘etheme_top_cart’)) {
    function etheme_top_cart() {
    global $woocommerce;
    ?>

    <div class=”shopping-cart-widget a-right” <?php if(etheme_get_option(‘favicon_badge’)) echo ‘data-fav-badge=”enable”‘ ?>>
    <div class=”cart-summ” data-items-count=”<?php echo $woocommerce->cart->cart_contents_count; ?>”>
    cart->get_cart_url(); ?>”><?php _e(‘Cart’, ETHEME_DOMAIN) ?> <span class=”items”><?php echo $woocommerce->cart->cart_contents_count; ?> <?php echo ($woocommerce->cart->cart_contents_count != 1) ? __(‘items’, ETHEME_DOMAIN) : __(‘item’, ETHEME_DOMAIN) ; ?></span> <span class=”for-label”><?php _e(‘for’, ETHEME_DOMAIN) ?></span> <span class=”price-summ”><?php echo $woocommerce->cart->get_cart_subtotal(); ?></span>
    </div>
    <div class=”cart-popup-container”>
    <div class=”cart-popup”>
    <?php
    etheme_cart_items(3);
    ?>
    </div>
    </div>
    </div>

    <?php
    }
    }

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    April 27, 2016 at 09:56

    Hello,

    I’ve added this code in child functions.php file:

    if(!function_exists('etheme_top_cart')) {
    function etheme_top_cart() {
    global $woocommerce;
    ?>
    <div class="shopping-cart-widget a-right" <?php if(etheme_get_option('favicon_badge')) echo 'data-fav-badge="enable"' ?>>
    <div class="cart-summ" data-items-count="<?php echo $woocommerce->cart->cart_contents_count; ?>">
    <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>"><?php _e('Cart', ETHEME_DOMAIN) ?> <span class="items"><?php echo $woocommerce->cart->cart_contents_count; ?> <?php echo ($woocommerce->cart->cart_contents_count != 1) ? __('items', ETHEME_DOMAIN) : __('item', ETHEME_DOMAIN) ; ?></span></a>
    </div>
    <div class="cart-popup-container">
    <div class="cart-popup">
    <?php
    etheme_cart_items(3);
    ?>
    </div>
    </div> 
    </div>
    <?php
    }
    }

    Please check now.

    Best regards,
    Jack Richardson.

    Avatar: moderninfluence
    Chad Leonard
    Participant
    May 10, 2016 at 09:56

    I am a little confused.

    I’ve worked on roughly 50 sites and the child theme files have always overwritten the parent theme files. Even if those files existed within sub-directories of the child theme. Is that not the case with your theme?

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    May 10, 2016 at 11:58

    Hello,

    The files from “framework” folder should be overwritten in child functions.php file in the Legenda theme.

    Best regards,
    Jack Richardson.

    Avatar: moderninfluence
    Chad Leonard
    Participant
    May 10, 2016 at 20:29

    Jack, sorry to bother you, I’m going to have a lot of changes to the parent theme and I want to make sure I’ve got my ducks in line.

    I understand that the field from the “framework” folder should be overwritten in the child functions.php but is that specific to that directory?

    I’ve added a new image to this location and it didn’t overwrite the parent theme –
    /public_html/lucca/wp-content/themes/legenda-child/images/label-new.png

    Which files get overwritten and which do not?

    Avatar: Eva
    Eva Kemp
    Support staff
    May 11, 2016 at 11:46

    Hello,

    You need also change url of the image in child style.css file:

    .label-icon.new-label {
        background-image: url(http://lucca.moderninfluence.com/wp-content/themes/legenda-child/images/label-new.png);
    }

    Regards,
    Eva Kemp.

    Avatar: moderninfluence
    Chad Leonard
    Participant
    May 11, 2016 at 21:11

    I added that code to the child style.css, but the default is still overwriting the child style.css. What do you suggest?

    Avatar: Robert Hall
    Robert Hall
    Support staff
    May 12, 2016 at 08:02

    Hello,

    I’ve added the !important value to code that in the Child Theme. Please check now.

    Regards,
    Robert Hall

    Avatar: moderninfluence
    Chad Leonard
    Participant
    May 12, 2016 at 17:05

    Thanks for the help! 😀

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    May 12, 2016 at 18:26

    Hello,

    You are welcome.

    Best regards,
    Jack Richardson.

  • Viewing 14 results - 1 through 14 (of 14 total)

The issue related to '‘Child Theme’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.