Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • uaus

    (@uaus)

    Hello @jules-colle

    Did you succeed to code any solution for adding TinyMCE to TranslatePress?

    Thank you!

    uaus

    (@uaus)

    For anyone looking how to add a custom field to the ckeckout form, here is how i added a Comments textarea.

    You field will also be added to the admin view of the order and the email notices.

    Just paste this in your functions.php

    
    /**
     * Add custom field to booking object post metabox
     *
     * @param object CMB2 object
     */
    function uau_cmb2_order_customer_fields($cmb)
    {
    
        $cmb->add_field(array(
            'name'       => __('Comments', 'ba-book-everything'),
            'id'         => 'order-comments',
            'type'       => 'textarea',
        ));
    
        return;
    }
    add_action('babe_cmb2_order_customer_fields', 'uau_cmb2_order_customer_fields', 10);
    
    function add_customs_order_fields($output, $args)
    {
    
        $comments = !empty($args['meta']['order-comments']) ? $args['meta']['order-comments'] : '';
    
        $output .= '<h3>' . __('Comments', 'ba-book-everything') . '</h3>';
    
        $output .= '<div class="address_fields_group input_group">
    				        <div class="checkout-form-block">
    				           <div class="checkout_form_input_field ' . (!empty($comments) ? 'checkout_form_input_field_content' : '') . '">
    				               <label class="checkout_form_input_label">' . __('Comments', 'ba-book-everything') . '</label>
    							   <textarea class="checkout_input_field" name="order-comments" id="order-comments" value="' . esc_attr($comments) . '"></textarea>
    						   </div>
    				        </div>
    				      </div>';
    
        return $output;
    }
    add_filter('babe_checkout_after_contact_fields', 'add_customs_order_fields', 20, 2);
    
    function sanitize_customs_order_fields($output, $arr)
    {
        $output['order-comments'] = isset($arr['order-comments']) ? sanitize_text_field($arr['order-comments']) : '';
        return $output;
    }
    add_filter('babe_sanitize_checkout_vars', 'sanitize_customs_order_fields', 20, 2);
    
    /**
     * Add checkout field titles
     */
    function uau_babe_checkout_field_label($field_title, $field_name)
    {
        if ($field_name === 'order-comments') {
            $field_title = __('Comments', 'ba-book-everything');
        }
        return $field_title;
    }
    add_filter('babe_checkout_field_label', 'uau_babe_checkout_field_label', 10, 2);
    

    That’s it.

    Thread Starter uaus

    (@uaus)

    Hello @tdgu

    You can recreate the issue using Advanced Custom Fields, using a Post Object field (it uses Ajax and it’s not loading any result).
    I’m also using ajax in a custom call on the frontend, using the wp_ajax_ hook (wp_ajax_$youraction): same problem.
    And if I have plugins which need to be updated, clicking on update fails (displays a “can’t connect” error. Can’t remember the error precisely since I downgraded.

    I have WP installed in a subdirectory.

    I tried to not block JSON with the new version and I’m still having the issue.
    Without changing settings between the two versions, the old one is working perfectly.

    Thank you!

    Same here.
    And look at this: https://23.239.13.127/

    Hi, is %CT-customtaxonomy% working now for Facebook too?
    We need that!
    Thank you for your great work.

Viewing 5 replies - 1 through 5 (of 5 total)