This topic has 14 replies, 4 voices, and was last updated 8 years, 7 months ago ago by Jack Richardson
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?
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.
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
Hello,
Please specify what changes you’ve made in the file legenda-child/framework/woo.php.
Best regards,
Jack Richardson.
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
}
}
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.
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?
Hello,
The files from “framework” folder should be overwritten in child functions.php file in the Legenda theme.
Best regards,
Jack Richardson.
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?
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.
I added that code to the child style.css, but the default is still overwriting the child style.css. What do you suggest?
Hello,
I’ve added the !important
value to code that in the Child Theme. Please check now.
Regards,
Robert Hall
Thanks for the help! 😀
Hello,
You are welcome.
Best regards,
Jack Richardson.
The issue related to '‘Child Theme’' has been successfully resolved, and the topic is now closed for further responses