ID : $thepostid; $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ''; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; switch ( $data_type ) { case 'price' : $field['class'] .= ' wc_input_price'; $field['value'] = wc_format_localized_price( $field['value'] ); break; case 'decimal' : $field['class'] .= ' wc_input_decimal'; $field['value'] = wc_format_localized_decimal( $field['value'] ); break; case 'stock' : $field['class'] .= ' wc_input_stock'; $field['value'] = wc_stock_amount( $field['value'] ); break; default : break; } // Custom attribute handling $custom_attributes = array(); if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { foreach ( $field['custom_attributes'] as $attribute => $value ){ $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; } } echo '
'; if ( ! empty( $field['description'] ) ) { if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) { echo ''; } else { echo '' . wp_kses_post( $field['description'] ) . ''; } } echo '
'; } /** * Output a hidden input box. * * @param array $field */ function woocommerce_wp_hidden_input( $field ) { global $thepostid, $post; $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; echo ' '; } /** * Output a textarea input box. * * @param array $field */ function woocommerce_wp_textarea_input( $field ) { global $thepostid, $post; $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ''; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); // Custom attribute handling $custom_attributes = array(); if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { foreach ( $field['custom_attributes'] as $attribute => $value ){ $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; } } echo ''; if ( ! empty( $field['description'] ) ) { if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) { echo ''; } else { echo '' . wp_kses_post( $field['description'] ) . ''; } } echo '
'; } /** * Output a checkbox input box. * * @param array $field */ function woocommerce_wp_checkbox( $field ) { global $thepostid, $post; $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'checkbox'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'yes'; $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; // Custom attribute handling $custom_attributes = array(); if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { foreach ( $field['custom_attributes'] as $attribute => $value ){ $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; } } echo ''; if ( ! empty( $field['description'] ) ) { if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) { echo ''; } else { echo '' . wp_kses_post( $field['description'] ) . ''; } } echo '
'; } /** * Output a select input box. * * @param array $field */ function woocommerce_wp_select( $field ) { global $thepostid, $post; $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); // Custom attribute handling $custom_attributes = array(); if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { foreach ( $field['custom_attributes'] as $attribute => $value ){ $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; } } echo ''; if ( ! empty( $field['description'] ) ) { if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) { echo ''; } else { echo '' . wp_kses_post( $field['description'] ) . ''; } } echo '
'; } /** * Output a radio input box. * * @param array $field */ function woocommerce_wp_radio( $field ) { global $thepostid, $post; $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; echo ''; }