Comment on post

Hi,

You forgot to include your FTP Password.

Please provide it in secure note so we can further check on this.

Thank you

1 Like

Hey @tarekr,

Here is your current setup. You have two site on a multisite setup.

Both of those sites are using the same Pro child theme.

Did you try what I suggested previously?

I realized I should have added that once you’ve done that, you should use the child theme that has the translation or language folder with the .po and .mo files for https://tarekrabaa.com. You leave the other child theme as is for https://tarekrabaa.com/en/. Without translation. Can we try this?

Thanks.

yes plz. but i want the wordpress language to be english for both tarekrabaa.com and tarekrabaa.com/en/

I tested and regretfully, it doesn’t work so you need to use the gettext filter. Here’s a sample code I used in the child theme.

// Translate Strings
add_filter( 'gettext', 'translate_x_strings', 20, 3 );

function translate_x_strings( $translated_text, $text, $domain ) {

    if ( is_singular() ) {

        switch ( $translated_text ) {

            case 'Leave a Comment' :

                $translated_text = __( 'اترك تعليقا', '__x__' );
                break;

            case 'Leave a Reply' :

                $translated_text = __( 'اترك رد', '__x__' );
                break;
        }

    }

    return $translated_text;
}

This is the only method I tried that will only translate strings in the front-end but not in the back-end (settings).

You might want search if this is possible with third party plugins like WPML.

Thanks.

1 Like

thx for your efforts.
At least it works partially.
How can i change the font size of the comment window (Name, Email…)?

Hello @tarekr,

Thanks for updating the thread.

You can add following CSS to change comment form label font size under Pro > Theme Options > CSS:

.comment-form-comment label {
    font-size: 18px;
}

Thanks.

1 Like

. Hi,
I am using English in both sites for wordpress backend but different languages in the front end. I tried all the plugin and none has worked for such case. Already i got some idea to translate some strings but the issue for the comment is not only related to .pot file translation but also to add functions in the function.php as per the previous thread.

thx

Hi,

I am sorry but at this time I am not entirely certain what it is you would like to accomplish based on the information given in your reply.

Did the code provided by my colleague did not work?

Please try this code instead.

.comment-form p > label {
      font-size: 18px !important;
}

You may change 18px to adjust.

Please also note that you can add more text to translate in your child theme functions.php code

eg.

// Translate Strings
add_filter( 'gettext', 'translate_x_strings', 20, 3 );

function translate_x_strings( $translated_text, $text, $domain ) {

    if ( is_singular() ) {

        switch ( $translated_text ) {

            case 'Leave a Comment' :

                $translated_text = __( 'اترك تعليقا', '__x__' );
                break;

            case 'Leave a Reply' :

                $translated_text = __( 'اترك رد', '__x__' );
                break;
           case 'Name' :
                $translated_text = __( 'اسم');
                break;
           case 'Email' :

                $translated_text = __( 'البريد الإلكتروني' );
                break;
          case 'Website' :

                $translated_text = __( 'موقع الكتروني' );
                break;
        }

    }

    return $translated_text;
}

Hope that helps.

1 Like

thx very much indeed.

Hello,

It works.
Remaining this (Your email address will not be published. Required fields are marked *). I tried the same method but it didn’t work.

Also, i would like to adjust the size of the comment box to fit with the format of the post because it is wider than the text in the post above it. And, i want the text inside the comment box to be RTL and not LTR.

In the meta the word is comment if one single comment and comments if more than one. I was not able to translate it. Any way to do it?

would you plz help.

Thx

Hi there,

In that case, please try this https://developer.wordpress.org/reference/hooks/comment_form_defaults/

Sample is this, you can add this to your functions.php too

function change_comment_text( $texts ) { 

$texts['comment_notes_before'] = 'Your email address will not be published. Required fields are marked *'; 

return $texts; 

} 

add_filter('comment_form_defaults','change_comment_text');

Then just change the text Your email address will not be published. Required fields are marked *.

The comment and the content has the same width, it’s just the content has white spaces (padding). If you wish same padding on comment section then please add this CSS to your global custom CSS.

    [lang="ar"] .x-comments-area {
     padding: 0px 60px;   
    }

As for comments meta translation, please translate these through theme’s language files (your first translation).

Leave a comment on: “%s” Leave a Comment %s Comment %s Comments

Please note that %s is important, it’s placeholder where numbers are added. That’s why translating just comment or comments will not work. The %s is part of the string.

Thanks!

1 Like

Thx for your support.
I tried to remove the avatar for the comments from settings/discussion. but when I save it return to show Avatar.
Any idea?
I used .x-comment-img .avatar-wrap { display:none;
}
The avatar disappear bu the size of comment content didn’t stretch as per the empty form of the comment.

Hello There,

Please have your code updated and use this:

.x-comment-img .avatar-wrap {
    display:none;
}

article.comment {
    margin-left: 0;
}

We would loved to know if this has work for you. Thank you.

It works. Many thx

You are most welcome. :slight_smile:

1 Like

Hi,

Regarding this function it works but the sign * color changed to gray. It was red. How can i make it RED?
`function change_comment_text( $texts ) {

$texts[‘comment_notes_before’] = ‘Your email address will not be published. Required fields are marked *’;

return $texts;

}

add_filter(‘comment_form_defaults’,‘change_comment_text’);`

Hey There,

The code is only meant to change the text being displayed. it does not change its color. If you want to make it red, please use this custom css instead:

.comment-notes {
    color: red;
}

Hope this helps. Kindly let us know.

Hi. It didn’t work

Hello,

The translation of the string Leave a comment on: “%s” was successful in the theme fucntion.php

However, I failed to translate to the following strings:
Leave a Comment
%s Comment
%s Comments

I was not able to identify in which file they are.

I still need to translate two strings which I pointed in the attached file.

Many thx

Hey There,

You will have to update your code into this:

function change_comment_text( $texts ) { 

  $texts['comment_notes_before'] = '<p class="comment-notes" style="color: red;">Your email address will not be published. Required fields are marked <span>*</span></p>'; 
  
  return $texts; 

} 
add_filter('comment_form_defaults','change_comment_text');

And also, you can find Comment keyword in /wp-content/themes/pro/framework/views/ethos/wp-comments.php file. You will need to copy this file, add your translations and upload this file to your child theme’s folder /wp-content/themes/pro-child/framework/views/ethos/.

Hope this helps.

1 Like