Issue
I am coding a simple plugin and I have a line of code:
echo "<p style=\"color:red;\">Please enter a valid email address!</p>";
But in order to localize / internationalize the plugin, I need to use the function like:
_e('Please enter a valid email address!','mytextdomain')
Then may I know how do I style the text inside the _e() function?
Any help will be appreciated, thank you very much!
Regards KC
Solution
As per the WordPress standard you can not use the html tag inside the _e() function. Here I have shared the WordPress official link for your reference: URL: https://developer.wordpress.org/reference/functions/_e/
As you can see in this function 1st parameter is string $text and 2nd paramenter string $domain = 'default'.
Here I have shared the example of code which you can use.
echo '<p style="color:red;">' . __( 'Please enter a valid email address!', 'mytextdomain' ) . '</p>';
Answered By - ZealousWeb
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.