• Resolved blazeblaze

    (@blazeblaze)


    Hi,

    First of all thanks for the great theme!

    In the “leave comment” area (Polish translation, newest version of Lightword) I can’t change the texts that label the fields that say:

    Nazwa(required)
    E-mail(required)
    Witryna internetowa

    I believe it applies to other language versions too.

    I have edited the pot file (mo), tried to edit comments.php, remove some lines, add some lines, I’ve searched the files manually for those words and I could not find those words anywhere!

    They must be somewhere and it should be possible to alter/change them.

    Please help. I want to change the texts.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter blazeblaze

    (@blazeblaze)

    I was trying to fix it again, and discovered that the small section seems to be disconnected from lightword theme or the language file. See the picture:

    What should I do to change the texts or how to find the proper file? Those texts must be somewhere.

    Thread Starter blazeblaze

    (@blazeblaze)

    Thread Starter blazeblaze

    (@blazeblaze)

    $req = get_option( 'require_name_email' );
    	$aria_req = ( $req ? " aria-required='true'" : '' );
    	$fields =  array(
    		'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
    		            '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
    		'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
    		            '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
    		'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' .
    		            '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
    	);

    I have found this code in the comment-template.php in the wp-includes directory. It seems to contain the code responsible for the fields. However I have no idea how to apply the changes in the texts I have indicated in the picture.

    Thread Starter blazeblaze

    (@blazeblaze)

    I have found a simple solution how to disable using the comment-template.php. Maybe it will be helpful for someone else:

    In the lightword comments.php find the line:

    <?php
    if ( function_exists('comment_form') ) {
    comment_form(array(
                            'label_submit' => __('Submit','lightword'),
    (...)
                            ));
    }else{
    ?>

    And from the if ( function_exists('comment_form') ) remove comment_form.

    Thread Starter blazeblaze

    (@blazeblaze)

    It was a bad idea ?? Submitting comments stopped working. It says that one have to fill in name and email now :O ??

    Michael

    (@alchymyth)

    Thread Starter blazeblaze

    (@blazeblaze)

    Hi alchymyth!

    Thanks for the link. That’s something I may work with now.

    Do you know which code and where should I put it? I am not a php programmer unfortunately. I do everything trial, error, deduct method ??

    Michael

    (@alchymyth)

    i pasted the code and instructions into:

    https://wordpress.pastebin.com/eBNPZ7EQ

    hope, this might work ??

    (unfortunately, the theme does not supply the original, editable .po language files; with them, you would be able to change the words in the translation files; )

    Thread Starter blazeblaze

    (@blazeblaze)

    The code works!
    <beer, whiskey, vodka, wine> whatever you prefer ??
    Thanks

    Michael

    (@alchymyth)

    to answer in the spirit of the late Dave Allen, comedian: <yes, yes, yes, yes>

    you are welcome; have a good time ??

    BubuTech

    (@bubutech)

    Hi all,

    Sorry for my english ??

    Replace this line in file “comments.php”
    'title_reply' => 'Leave a comment',
    by
    'title_reply' => __('Leave a comment','lightword'),

    and find this lines in file “fonctions.php”

    function lightword_comment_fields ($fields) {
    foreach ($fields as $name => $field) {
    $fields[$name] = preg_replace('/(<label(?:.*?)>(?:.*?)<\/label>)\s*(<span class="required">\*<\/span>)?\s*(<input(?:.*?)\/>)/', '\3\1\2',$field);
    $fields[$name] = str_replace("*", "(required)", $fields[$name]);
    }
    return $fields;
    }

    add_filter('comment_form_default_fields', 'lightword_comment_fields');
    replace by
    $fields[$name] = str_replace("*", "(IN YOUR LANGUAGE)", $fields[$name]);
    I did not find better for the moment. By hoping to have helped.

    Is this solution only for lightword or does it work in other themes as well?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Cannot change text in the leave comment area Bug? Please help.’ is closed to new replies.