Hi,
In which file must I change the code to translate the fieldname Name, Email Adress and Website and the submit button text?
Hi,
In which file must I change the code to translate the fieldname Name, Email Adress and Website and the submit button text?
First, open the Admin Panel, and navigate to Appearance > Editor. Then, you can open the comment form's code by selecting Contact Form Page Template on the right. In the code area find lines of code that read like this:
<?php _e('Website','avisio'); ?>
You only have to change the text Website (or name, etc.) to get the desired effect.
Thanks but this is for the contactform not the comments form for the blog.
Please open up comments.php and make the required changes there - search for following code:
if ($comment_author == '') $comment_author = __('Name');
if ($comment_author_email == '') $comment_author_email = __('E-Mail Adress');
if ($comment_author_url == '') $comment_author_url = __('Website');
and change the words Name, Emil, etc. to your needs.
Hi Dude,
Yes it works ... thanks for your help.
Glad that I could help you.
Hi Dude,
I translated the Comments-Form aswell. Here is my (German) translation:
if ($comment_author_url == '') $comment_author_url = __('Webseite');
The form looks fine but I have a problem.
If the "Webseite"-field is not filled out, the value "http://webseite/" is saved into the database.
It would be nicer if nothing would be saved in this case.
Can you help?
Thank you very much!
Side note: I am using the Habitat-Theme. But I guess it is the same situation...
You can remove this "auto generated value" by replacing following code in comments.php:
<p><input type="text" name="email" class="text_input" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
<label for="email"><small><?php _e('Mail (will not be published)','habitat'); if ($req) echo " (required)"; ?></small></label></p>
with:
<p><input type="text" name="email" class="text_input" id="email" value="" size="22" tabindex="2" />
<label for="email"><small><?php _e('Mail (will not be published)','habitat'); if ($req) echo " (required)"; ?></small></label></p>I guess you are talking about this line....
<p><input type="text" name="url" class="text_input" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website','habitat'); ?></small></label></p>
But this is not a good solution because now there is nothing that tells us that this field is for the website-URL.
The field is just empty. See here: http://www.notopia.net/blog/1924/social-entrepreneur#respond
Isn't there a better solution?
Thanks!
Hey,
just replace
<p><input type="text" name="url" class="text_input" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website','habitat'); ?></small></label></p>
with:
<p><input type="text" name="url" class="text_input" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website','habitat'); ?></small></label></p>
<?php
if ( $comment_author_url == 'Website' ) { $comment_author_url = '';}
?>
This should keep the "website" value for the form field but delete it afterwards in the background if nothing was inserted in the website field...
This does not work unfortunately.
This operation has to be done in the script that processes the post (wp-comments-post.php).
But this is a core-script. So I don't want to change it.
Do you have any idea how to do it?
What strikes me: I translated "E-Mail-Adresse" into German. If no mail is entered, no value is saved. Why does it work with the mail and not with the url?
Thank you very much!
Damn...I didn't test the code but I thought it would do what you wan't...(because it changes the value of the variable before the post/get php code)
Yes you're right after all - the last solution is to modify the core files. I didn't look into it but I think the reason why the email field behaves different is because WP checks the input (i.e. if a "@" symbol exists, valid e-mail adress structure, etc.) - obviously the website field doesn't support this validation function.
Is there a solution for this bug? I have been working for 5 months with the Cleancut Theme and I do not know how to delete the link when the field "Website" is empty.
I am sure than someone has found it!
Hey,
In the short term you can modify the comments link by editing the comment in WP Admin.
I'll look into why this isn't working and hopefully provide a long term solution.
James
You must log in to post.