I needed to create a custom form to implement a custom payment method (it is a donations form). I decided to use Code Snippets plugin and create the form in there. Every step is a snippet and every snippet is a page. So i got a form like(too long to paste all):
add_shortcode( 'don_form', function () {
$out = '<form class="uk-form uk-form-stacked" action="/" method="POST">
<legend>Title</legend>
<div class="uk-grid uk-grid-1-3">
<div class="uk-width-medium-1-3 uk-margin-top"><label class="uk-form-label" for="firstname"><span class="uk-text-danger">* </span>'. esc_html_e( 'Last name', 'woocommerce' ).':</label><input class="uk-form-large uk-width-1-1" type="text" id="firstname" name="firstname" required></div>
/*.............rest of the form........*/
<div class="uk-width-1-1 uk-margin-top"><input class="uk-button uk-button-default uk-button-large" type="submit" value="Next"></div>
</div>
</form>';
return $out;} );
It works ok but.....
esc_html_e( 'Last name', 'woocommerce' ) shows at the top of the page in the front end instead of inside the label tag. Why? is such usage not correct?