Created
November 15, 2018 10:35
-
-
Save jan-koch/cfa2731ff5755fe297990269dd816e2b to your computer and use it in GitHub Desktop.
Example for adding a text input field to the WooCommerce "General" tab.
This file contains 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 characters
<?php | |
function prefix_add_text_input() { | |
$args = array( | |
'label' => '', // Text in the label in the editor. | |
'placeholder' => '', // Give examples or suggestions as placeholder | |
'class' => '', | |
'style' => '', | |
'wrapper_class' => '', | |
'value' => '', // if empty, retrieved from post_meta | |
'id' => '', // required, will be used as meta_key | |
'name' => '', // name will be set automatically from id if empty | |
'type' => '', | |
'desc_tip' => '', | |
'data_type' => '', | |
'custom_attributes' => '', // array of attributes you want to pass | |
'description' => '' | |
); | |
woocommerce_wp_text_input( $args ); | |
} | |
add_action( 'woocommerce_product_options_pricing', 'prefix_add_text_input' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment