简体   繁体   中英

How to add php code into placeholder?

I have script where i set placeholder:

 $mailargs = array(

                'nametxt' => '',

                'emailtxt' => '',

                'nameholder' => 'Your Name',

                'emailholder' => 'Your Email Address',

                'submittxt' => 'GO',

                'jsthanks' => true,

                'thankyou' => 'Thank you for subscribing to our mailing list'

            );

Now i need to put this part of code in nameholder:

<?php _e('Stay in touch with latest news,events and exhibitions by subscribing to our official newsletter', 'wp-test'); ?>

Any suggestion how to do this?

You can include the _e() function within the array itself:

$mailargs = array(

    'nametxt' => '',

    'emailtxt' => '',

    'nameholder' => _e('Your Name','wp-test'),

    'emailholder' => _e('Your Email Address','wp-test'),

    'submittxt' => _e('GO','wp-test'),

    'jsthanks' => true,

    'thankyou' => _e('Thank you for subscribing to our mailing list','wp-test')
);

Which will give you the desired result within the $mailargs array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM