0

I don't know how to translate text that I use as placeholder for my comment form. I have a function in my function.php file where is defined how comment form should look like. Here is example of that code:

    $fields =  array(
        'author' => '<p class="comment-form-author">' .
                '<input id="author" name="author" placeholder="Name" type="text" required value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />',
        'email'  => '<p class="comment-form-email"> ' .
                '<input id="email" name="email" placeholder="E-mail" type="text" required value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
        'url'    => '<p class="comment-form-url">' .
                '<input id="url" name="url" placeholder="Website" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
     );

Can you help me here?

  • What is 'placeholder' supposed to be? What should the result look like? – s_ha_dum Jun 6 '13 at 15:59
  • Placeholder for exampe, for author is "Name". And I would like to add "Name" into .PO file so that user can change it. I tried to add placeholder="'._e( 'Name', 'tpmoments' ).'" but it doesnt work. @s_ha_dum – Valeka Jun 6 '13 at 16:05
0

In your code, you are concatenating a string but you are (from a comment) using a function that echos information-- _e(). You can't do that. You are printing the content wherever that array is constructed, which is not what you want.

Use __() instead.

  • Thanks! You were right, I used echo to get information from function. Works perfect! – Valeka Jun 6 '13 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.