Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #389198

    Hi

    If I want to use functions.php in a child theme do I just drag it into the child theme or copy it?

    Thanks
    Richard

    #389256

    Hey Richard!

    Child theme functions.php is not meant to be an exact copy of the parent theme functions.php but more of an empty file to put custom functions, hooks, etc.

    Regards,
    Josue

    #391060

    Hi Josue

    If that is the case then I need some help please.
    I have a functions.php file in the child theme with the following inside it

    <?php
    //add payment method to woocommerce order email
    add_action( 'woocommerce_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 );
    function add_payment_method_to_admin_new_order( $order, $is_admin_email ) {
      if ( $is_admin_email ) {
        echo '<p><strong>Payment Method:</strong> ' . $order->payment_method_title . '</p>';
      }
    }
    if ( is_product_category( 'large_filters' ) ) { $custom_sidebar = 'special'; }
    if ( is_product_category( 'ultra-chic' ) ) { $custom_sidebar = 'special'; }
    if ( is_product_category( 'accessories' ) ) { $custom_sidebar = 'special'; }

    My problem is the last three code lines are not working. They do work if I put them into the main functions.php file but that gets overwritten with updates.
    Regards
    Richard

    #391161

    Hey Richard!

    Try copying sidebar.php to your child theme directory and putting those three lines there instead (around line 39-40).

    Regards,
    Josue

    #392625

    Thanks Josue

    Yes I worked that out …my mistake…too many things going on

    Thank you

    #392645

    You are welcome, always glad to help :)

    Regards,
    Josue

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.