最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

using esc_html_e string in custom form using code snippets

programmeradmin0浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论