Home Forums WoodMart support forum Child theme does not accept the code I edited

Child theme does not accept the code I edited

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #665182

    I copied the folder path from the parent theme to the child theme, but when I edited the file in the child theme, it didn’t accept it. Please help me, how can I edit the code so that when I update the theme, it won’t be lost?

    theme\woodmart\inc\integrations\woocommerce\template-tags.php

    theme\woodmart-child\inc\integrations\woocommerce\template-tags.php

    #665269

    Luke Nielsen
    Keymaster

    Hello,

    Functions from template-tags.php you can override just via the functions.php file in your child theme.

    E.g. – https://prnt.sc/P0IcbxokdPnx

    Kind Regards

    #665578

    If I want to change the interface or change the location of a few places, how can I not change the interface again when I update the theme to the new version?

    #665695

    Luke Nielsen
    Keymaster

    Hello,

    All customizations that are in the Child theme will be saved after the update.

    So if you override some theme’s functionality via the Child theme, you will not lose it after the update.

    Kind Regards

    #665702

    But the important thing is how can I change and save my structure on the child theme. For example, I want to change the structure of the payment page a little bit, move the discount code input box position down like this, then how can I change it, but when updating the parent theme, it will not lose my structure

    https://prnt.sc/f0tMuDzgo-wQ

    #665759

    Luke Nielsen
    Keymaster
    #665765

    Yes. Thanks for the information. However, what if I want to edit the interface anywhere else?

    #665771

    Luke Nielsen
    Keymaster

    Some things you can edit via the Layouts builder – https://xtemos.com/docs-topic/woodmart-woocommerce-layout-builder/

    Also, you can copy this woocommerce/checkout/form-checkout.php file with its path via Child theme and make some changes there.

    Kind Regards

    #665774

    I copied from

    theme\woodmart\inc\integrations\woocommerce\template-tags.php
    to
    theme\woodmart-child\inc\integrations\woocommerce\template-tags.php

    I edited the code at theme\woodmart-child\inc\integrations\woocommerce\template-tags.php it did not overwrite my code

    #665835

    Luke Nielsen
    Keymaster

    Hello,

    The template-tags.php file cannot be overridden via Child theme, there are a lot of functions that can be overridden, just copy the function with the hook and paste it into the functions.php file of the Child theme.

    Clarify what exactly you are trying to change there, in the template-tags.php

    Kind Regards

    #665902

    I want to edit

    <div class=”wd-product-cats<?php echo woodmart_get_old_classes( ‘ woodmart-product-cats’ ); ?>”>

    <?php echo implode( ‘, ‘, $links ); // phpcs:ignore ?>
    </div>

    To

    <div class=”wd-product-cats<?php echo woodmart_get_old_classes( ‘ woodmart-product-cats’ ); ?>”>

    <?php
    if (!empty($links)) {
    echo end($links); // Only show the last link (deepest category)
    }
    ?>
    </div>

    So how is the funcion code?

    #666078

    Luke Nielsen
    Keymaster

    Hello,

    Copy this https://prnt.sc/nbgm0cbG7jho function in the red line to the functions.php file in your child theme, make the necessary changes and check how it works.

    Kind Regards

Viewing 12 posts - 1 through 12 (of 12 total)