Created
April 18, 2016 09:05
-
-
Save themepaint/cfef5e5300d54aa4ab3a1b084c37361a to your computer and use it in GitHub Desktop.
Revisions
-
themepaint created this gist
Apr 18, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ <?php // Display Fields add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); function woo_add_custom_general_fields() { global $woocommerce, $post; echo '<div class="options_group">'; woocommerce_wp_text_input( array( 'id' => 'ali_express_link', 'label' => __( 'AliExpress Link Here', 'woocommerce' ), 'placeholder' => 'http://', 'desc_tip' => 'true', 'description' => __( 'Enter the AliExpress Link here.', 'woocommerce' ) ) ); echo '</div>'; } // Save Fields add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' ); function woo_add_custom_general_fields_save( $post_id ){ // Text Field $woocommerceali_express_link = $_POST['ali_express_link']; if( !empty( $woocommerceali_express_link ) ) update_post_meta( $post_id, 'ali_express_link', esc_attr( $woocommerceali_express_link ) ); } // Display Custom Field Value $link = get_post_meta( get_the_ID(), 'ali_express_link', true ); ?>