Custom text for 'Read more' button at Travelify

Tried several ways to change text on “Read more” button for Travelify theme, but nothing was successful. I using Travelify translated to native language, but some texts isn’t translated yet - “No comments” , “Comments” and “Read more”.
Let me know how to fix it?

Hi @andres99,

I hope you are well today and thank you for your question.

The shared texts should get translated as they are translation ready.

Could you please share your site URL where the texts are not translated so that i ca troubleshoot it?

Also could you please try using the following code in the functions.php file of your child theme to translate the text?

function change_translate_text( $translated_text, $text, $domain ) {
	if ( $domain ==  "travelify" ){
		if( trim($translated_text) == 'Read more' ) {
			$translated_text = 'Custom Read more';
		} else if( trim($translated_text) == 'Comments' ) {
			$translated_text = 'Custom Comments';
		} else if( trim($translated_text) == 'No Comments' ) {
			$translated_text = 'Custom No Comments';
		}
	}
	return $translated_text;
}
add_filter( 'gettext', 'change_translate_text', 20, 3 );

Please change the custom text in the above code with the translated texts.

Best Regards,
Movin

Hi Movin,

Thanks for your support. The action was quite successful for “Read more” and “Comments”. But sign “No comments” that counts how much comments you have got still in English.
url is http://simplevent.com

Best Regards,
Andres

Hi Andres,

The "No comments” was not getting translated because we have written the first character of comments in lowercase which should be in upprercase as Comments.

I have updated my previously shared code with this change which will work fine for you so please try using this updated code and let me know how it works for you.

Regards,
Movin

Hi Movin,

Thanks. It works!

Best Regards,
Andres

Hi again Movin,

Sorry, but didn’t find how to edit my previous post. I found two new items that also isn’t translated yet: “Previous” and “Next” buttons.

Best Regards,
Andres

Hi Andres,

Please make sure to translate the “Previous” and “Next” texts as following.

« Previous

Next »

If the above texts also don’t translate then please try translating them by adding new conditions in the previously shared code as following.

function change_translate_text( $translated_text, $text, $domain ) {
	if ( $domain ==  "travelify" ){
		if( trim($translated_text) == 'Read more' ) {
			$translated_text = 'Custom Read more';
		} else if( trim($translated_text) == 'Comments' ) {
			$translated_text = 'Custom Comments';
		} else if( trim($translated_text) == 'No Comments' ) {
			$translated_text = 'Custom No Comments';
		} else if( trim($translated_text) == '« Previous' ) {
			$translated_text = 'Custom « Previous';
		} else if( trim($translated_text) == 'Next »' ) {
			$translated_text = 'Custom Next »';
		}
	}
	return $translated_text;
}
add_filter( 'gettext', 'change_translate_text', 20, 3 ); 

Regards,
Movin

Hello Movin,

Thanks for your support, now everything looks nice.

Regards,
Andres

You are most welcome here :slight_smile: