Tagged: x
-
AuthorPosts
-
October 20, 2016 at 10:20 am #1224013
OscarParticipantHello again!
I have two questions in this post.
How can i change the name of input fields?
How can i include a custom field to date of birth?http://www.intercambioesportivo.com/
http://www.intercambioesportivo.com/finalizar-inscricao/
I need to change the field name “name” to something else. Only the label.
Thank you!
October 20, 2016 at 1:11 pm #1224234
RupokMemberHi there,
I can’t see any form on your page. Would you point us with a screenshot?
Thanks!
October 20, 2016 at 1:30 pm #1224254
OscarParticipantThis reply has been marked as private.October 20, 2016 at 8:31 pm #1224751
LelyModeratorHi Oscar,
Please try adding the following code on Appearance > Customize > Custom > Edit Global javascript:
jQuery('#billing_first_name_field [for="billing_first_name"]').text("NewTextforName");I also found that this current custom code is giving you syntax error. We need to fixed this first because it will prevent above code from working:
function navbarChangeColor() { var $slider = $(\'.x-slider-revolution-container.below\'), $sliderHeight = $slider.outerHeight(); $navbar = $(\'.x-navbar\'); if( $(window).scrollTop() > $sliderHeight ) { $navbar.addClass(\'nb-trans\'); } else { $navbar.removeClass(\'nb-trans\'); } }Update to this:
function navbarChangeColor() { var $slider = $('.x-slider-revolution-container.below'), $sliderHeight = $slider.outerHeight(); $navbar = $('.x-navbar'); if( $(window).scrollTop() > $sliderHeight ) { $navbar.addClass('nb-trans'); } else { $navbar.removeClass('nb-trans'); } }Hope this helps.
October 21, 2016 at 3:23 am #1225128
OscarParticipantThanks, it worked!
Also fix the code as indicated me.
Nice to know I can count on your concern.I have this final question on another topic you and Theme.co team helped me to put custom fields in the registration stand via functions.php.
I could do other alone, but I have no idea how to create a field “date of birth”.
Can you help me?
October 21, 2016 at 4:44 am #1225201
RadModeratorHi there,
Is it ACF related and where it should be displayed? Please provide the other thread for reference.
Thanks!
October 23, 2016 at 4:16 am #1227099
OscarParticipantThis is the code that one of his colleagues gave me. It includes a field in woocommerce form to finalize the purchase.
/** * Custom Field Nome do Responsável **/ add_action( 'woocommerce_before_order_notes', 'nome_responsavel' ); function nome_responsavel( $checkout ) { echo '<div id="nome_responsavel">'; woocommerce_form_field( 'nome_responsavel', array( 'type' => 'text', 'class' => array('nome_responsavel form-row-wide'), 'label' => __('Nome do Responsável'), 'placeholder' => __('Digite o nome do Responsável pagante'), ), $checkout->get_value( 'nome_responsavel' )); echo '</div>'; } add_action('woocommerce_checkout_process', 'validar_nome_responsavel_woocommerce'); function validar_nome_responsavel_woocommerce() { if ( empty( $_POST['nome_responsavel']) ) wc_add_notice( __( 'Obrigatório o preenchimento.' ), 'error' ); } add_action( 'woocommerce_checkout_update_order_meta', 'novo_campo_checkout_order' ); function novo_campo_checkout_order( $order_id ) { if ( ! empty( $_POST['nome_responsavel'] ) ) { update_post_meta( $order_id, 'Nome do Responsável', sanitize_text_field( $_POST['nome_responsavel'] ) ); } } add_action( 'woocommerce_admin_order_data_after_billing_address', 'mostrar_nome_responsavel', 10, 1 ); function mostrar_nome_responsavel($order){ echo '<p><strong>'.__('Nome do Responsável').':</strong> ' . get_post_meta( $order->id, 'Nome do Responsável', true ) . '</p>'; } /**Can you help me change to a field to include the date of birth?
October 23, 2016 at 5:03 am #1227133
RadModeratorHi there,
The same as where this is placed
echo '<div id="nome_responsavel">'; woocommerce_form_field( 'nome_responsavel', array( 'type' => 'text', 'class' => array('nome_responsavel form-row-wide'), 'label' => __('Nome do Responsável'), 'placeholder' => __('Digite o nome do Responsável pagante'), ), $checkout->get_value( 'nome_responsavel' )); echo '</div>';Example,
echo '<div id="nome_responsavel">'; woocommerce_form_field( 'nome_responsavel', array( 'type' => 'text', 'class' => array('nome_responsavel form-row-wide'), 'label' => __('Nome do Responsável'), 'placeholder' => __('Digite o nome do Responsável pagante'), ), $checkout->get_value( 'nome_responsavel' )); echo '</div>'; echo '<div id="woo_birth_date">'; woocommerce_form_field( 'woo_birth_date', array( 'type' => 'text', 'class' => array('woo_birth_date form-row-wide'), 'label' => __('Birth Date'), 'placeholder' => '', ), $checkout->get_value( 'woo_birth_date' )); echo '</div>';Then if you have a jQuery Datepicker library, you can simply attached it to
.woo_birth_dateclass.Example, let’s say you already installed your Datepicker library then you can add this to your custom javascript.
(function($) { $('.woo_birth_date').datepicker(); }(jQuery));Another sample http://stackoverflow.com/questions/27462984/use-jquery-datepicker-in-wordpress
Datepicker is optional, the field should work as normal textbox without it.
Hope this helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1224013 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
