• Please all the forms(search, cart, checkout, contact, login) on my website do not work when the kadence child theme is active. it is happening only on iPhones and iPads.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,
    What do you have in your child theme?

    Ben

    Thread Starter Theophilus Opoku Bannor

    (@rostilupt)

    these are what i have in my child theme php

    /**
     * Initiate the product title switch.
     */
    function init_custom_woocommerce_product_loop_tags() {
     if ( class_exists( 'Kadence\Theme' ) ) {
        $kadence_theme_class = Kadence\Theme::instance();
        remove_action( 'woocommerce_shop_loop_item_title', array( $kadence_theme_class->components['woocommerce'], 'archive_title_with_link' ) );
        add_action( 'woocommerce_shop_loop_item_title', 'custom_kadence_archive_title' );
     }
    }
    add_action( 'init', 'init_custom_woocommerce_product_loop_tags' );
    
    /**
     * Show the product title in the product loop.
     */
    function custom_kadence_archive_title() {
     global $product;
    
     $link = apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product );
     echo '<h3 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '"><a href="' . esc_url( $link ) . '" class="woocommerce-LoopProduct-link-title woocommerce-loop-product__title_ink">' . get_the_title() . '</a></h3>';
    }
    /**
     * @snippet       Add new textarea to Product Category Pages - WooCommerce
     * @how-to        Get CustomizeWoo.com FREE
     * @author        Rodolfo Melogli
     * @compatible    WooCommerce 3.9
     * @donate $9     https://businessbloomer.com/bloomer-armada/
     */  
     
    // ---------------
    // 1. Display field on "Add new product category" admin page
     
    add_action( 'product_cat_add_form_fields', 'bbloomer_wp_editor_add', 10, 2 );
     
    function bbloomer_wp_editor_add() {
        ?>
        <div class="form-field">
            <label for="seconddesc"><?php echo __( 'Second Description', 'woocommerce' ); ?></label>
           
          <?php
          $settings = array(
             'textarea_name' => 'seconddesc',
             'quicktags' => array( 'buttons' => 'em,strong,link' ),
             'tinymce' => array(
                'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
                'theme_advanced_buttons2' => '',
             ),
             'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
          );
     
          wp_editor( '', 'seconddesc', $settings );
          ?>
           
            <p class="description"><?php echo __( 'This is the description that goes BELOW products on the category page', 'woocommerce' ); ?></p>
        </div>
        <?php
    }
     
    // ---------------
    // 2. Display field on "Edit product category" admin page
     
    add_action( 'product_cat_edit_form_fields', 'bbloomer_wp_editor_edit', 10, 2 );
     
    function bbloomer_wp_editor_edit( $term ) {
        $second_desc = htmlspecialchars_decode( get_woocommerce_term_meta( $term->term_id, 'seconddesc', true ) );
        ?>
        <tr class="form-field">
            <th scope="row" valign="top"><label for="second-desc"><?php echo __( 'Second Description', 'woocommerce' ); ?></label></th>
            <td>
                <?php
              
             $settings = array(
                'textarea_name' => 'seconddesc',
                'quicktags' => array( 'buttons' => 'em,strong,link' ),
                'tinymce' => array(
                   'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
                   'theme_advanced_buttons2' => '',
                ),
                'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
             );
     
             wp_editor( $second_desc, 'seconddesc', $settings );
             ?>
           
                <p class="description"><?php echo __( 'This is the description that goes BELOW products on the category page', 'woocommerce' ); ?></p>
            </td>
        </tr>
        <?php
    }
     
    // ---------------
    // 3. Save field @ admin page
     
    add_action( 'edit_term', 'bbloomer_save_wp_editor', 10, 3 );
    add_action( 'created_term', 'bbloomer_save_wp_editor', 10, 3 );
     
    function bbloomer_save_wp_editor( $term_id, $tt_id = '', $taxonomy = '' ) {
       if ( isset( $_POST['seconddesc'] ) && 'product_cat' === $taxonomy ) {
          update_woocommerce_term_meta( $term_id, 'seconddesc', esc_attr( $_POST['seconddesc'] ) );
       }
    }
     
    // ---------------
    // 4. Display field under products @ Product Category pages 
     
    add_action( 'kadence_after_footer', 'bbloomer_display_wp_editor_content', 5 );
     
    function bbloomer_display_wp_editor_content() {
       if ( is_product_taxonomy() ) {
          $term = get_queried_object();
          if ( $term && ! empty( get_woocommerce_term_meta( $term->term_id, 'seconddesc', true ) ) ) {
             echo '<p class="term-description">' . wc_format_content( htmlspecialchars_decode( get_woocommerce_term_meta( $term->term_id, 'seconddesc', true ) ) ) . '</p>';
    		  }
       }
    }
    /**
     * remove add to cart buttons on shop archive page
     */
     
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);

    the css is just the default one. i haven’t touch the css

    Thread Starter Theophilus Opoku Bannor

    (@rostilupt)

    I am currently switched to the parent theme with the custom codes in the child theme been transferred but the forms work well. So I think the issue is with the child theme. I downloaded it from the kadence website.

    Hey,
    The custom functions you are adding are going to be the issue, the example child theme from our site is empty and nothing would run if left empty.

    Find out what is in your PHP error log. That will help determine which one of your functions is either being called too early or incorrectly.

    Ben

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘forms not working with child theme’ is closed to new replies.