admin_url( 'admin-ajax.php' ) ) ); $result = '
'; return $result; } add_action('wp_ajax_load_code_from_id', 'load_code_from_id'); add_action('wp_ajax_nopriv_load_code_from_id', 'load_code_from_id'); function load_code_from_id() { $code_id = (isset($_POST['code_id']))?esc_attr($_POST['code_id']) : ''; //echo $code_id; /* $ids = (isset($_POST['product_ids']))?esc_attr($_POST['product_ids']) : ''; //echo $product_ids; $product_ids = explode(',', $ids); foreach ($product_ids as $product_id) { WC()->cart->add_to_cart( intval($product_id), 1, 0, array(), array() ); // WC()->cart->add_to_cart( $product_id = 0, $quantity = 1, $variation_id = 0, $variation = array(), $cart_item_data = array() ); } //return cart count echo WC()->cart->cart_contents_count;*/ echo get_field( "html", $code_id ).'|'.get_field( "css", $code_id ).'|'.get_field( "js", $code_id ); die(); } // add popup to theme function add_to_theme(){ echo do_shortcode( '[lightbox id="cf-save-code" width="600px" padding="20px"] [block id="cf-save-code"] [/lightbox] [lightbox id="cf-email-code" width="600px" padding="20px"] [block id="cf-email-code"] [/lightbox]'); } add_action('wp_footer', 'add_to_theme'); // sau khi người dùng gởi thông tin add_action("wpcf7_before_send_mail", "wpcf7_do_something"); function wpcf7_do_something($WPCF7_ContactForm){ //Get current form $wpcf7 = WPCF7_ContactForm::get_current(); // get current SUBMISSION instance $submission = WPCF7_Submission::get_instance(); // Ok go forward if ($submission) { // get submission data $data = $submission->get_posted_data(); switch ($WPCF7_ContactForm->id()) { case 5479: // Tạo post luu code break; case 5480: // email code /* $cf_post_id = $data['gs-id']; write_log('cf_post_id = '.$cf_post_id); $uploaded_files = $submission->uploaded_files(); if ($uploaded_files) { foreach ($uploaded_files as $fieldName => $filepath) { //write_log('fieldName = '.$fieldName); //cf7 5.4 if (is_array($filepath)) { //write_log('filepath = '.$filepath); foreach ($filepath as $key => $value) { //write_log('key='.$key); $data = cf_nmr_create_attachment($value, $cf_post_id, $fieldName); } } else { $data = cf_nmr_create_attachment($filepath, $cf_post_id, $fieldName); } } } */ break; default: break; } } } ?> Icon đẹp cho thiết kế web - Code & Coffe
Tìm theo từ khóa

Icon đẹp cho thiết kế web

Icon đẹp cho thiết kế web