Advertisement
nebojsab

Untitled

Mar 3rd, 2014
434
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Custom field for price labels
  2.  
  3. // Display Fields
  4. add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
  5.  
  6. // Save Fields
  7. add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
  8.  
  9. function woo_add_custom_general_fields() {
  10.  
  11. global $woocommerce, $post;
  12.  
  13. // Textarea
  14. woocommerce_wp_textarea_input(
  15. array(
  16. 'id' => '_textarea',
  17. 'label' => __( 'My Textarea', 'woocommerce' ),
  18. 'placeholder' => '',
  19. 'description' => __( 'Enter the custom value here.', 'woocommerce' )
  20. )
  21. );
  22. // Textarea
  23. $woocommerce_textarea = $_POST['_textarea'];
  24. if( !empty( $woocommerce_textarea ) )
  25. update_post_meta( $post_id, '_textarea', esc_html( $woocommerce_textarea ) );
  26.  
  27. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement