How could i add username field in WooCommerce

// Add Username Field to Registration Form add_action( ‘woocommerce_register_form_start’, ‘custom_woocommerce_register_username’ ); function custom_woocommerce_register_username() { ?> <p class=”form-row form-row-wide”> <label for=”reg_username”><?php _e( ‘Username’, ‘woocommerce’ ); ?> <span class=”required”>*</span></label> <input type=”text” class=”input-text” name=”username” id=”reg_username” value=”<?php echo ( ! empty( $_POST[‘username’] ) ) ? esc_attr( wp_unslash( $_POST[‘username’] ) ) : ”; ?>” /> </p> <?php } // Validate … Read more

has_term not returning anything

If your second code block is in the same code block as your first, then adding $post->ID as the third parameter of the has_term() call should fix it: if ( has_term( ‘closed-captions’, ‘accessibility-options’, $post->ID ) ) { echo ‘CC’; } If it doesn’t then as Tom mentioned, please update your question to include the surrounding … Read more

Add up all numbers from a WordPress query [closed]

.= does string concatention, eg, ‘hello ‘ . ‘world’ gets you hello world. To add, use + instead of .: // Set a default for $numbers. $numbers = 0; $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $party_size = get_field(‘reservation_party_size’, $post_id); $numbers += intval( $party_size ); } } return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)