I updated x theme and now a couple of things do not work anymore

Hi there:

I updated x theme yesterday - and now links (boxes that are linked to pages) on homepage are not working and “leave a comment” used to be translated into German “Kommentar” is now back to leave a comment. Can you help, please.

Thank you.

Hi,

Upon checking, I can see some js error in the console.

Please remove this code in Customizer> Custom JS as you have added it already in Cornerstone > JS

 (function($){
  //$('<a id="link_1" href="http://happycoollove.de/happycoollove-blog">').insertBefore('#link1');
  $('#link1').on('click',function(e){
    window.location ="http://happycoollove.de/happycoollove-blog";
  });
  $('#link1').css({"cursor":"pointer";});
})(jQuery);
(function($){
  //$('<a id="link_2" href="http://perisoylu.us15.list-manage.com/subscribe?u=13b528df698fdd12b3e3fd387&id=4ffa1491df">').insertBefore('#link2');
  $('#link2').on('click',function(e){
    window.location ="http://perisoylu.us15.list-manage.com/subscribe?u=13b528df698fdd12b3e3fd387&id=4ffa1491df";
  });
  $('#link2').css({"cursor":"pointer";});
})(jQuery);                                
(function($){                                
  //$('<a id="link_3" href="http://happycoollove.de/coaching">').insertBefore('#link3');
  $('#link3').on('click',function(e){
    window.location ="http://happycoollove.de/coaching";
  });
  $('#link3').css({"cursor":"pointer";}); 
})(jQuery);

Then navigate to Cornerstone > JS and remove semicolon from this.

$('#link3').css({"cursor":"pointer";}); 

It should be

$('#link3').css({"cursor":"pointer"}); 

No semicolon after pointer.

Hope this helps

Hi Paul:

Thank you for your reply and your kind help!

I did exactly as you said and it did not work. But it was very valuable information nontheless, because I knew at least where to look. What worked was to delete the corresponding code in Cornerstone > JS completely and not the code in Customizer > Cumstom JS. However, there I removed ALL semicolons for ALL links (link 1 - link 3), not only for link 3 and now it works fine. I hope it will stay this way, even if there is another update! :slight_smile:

The other question I have: Why did the “leave a comment” function in my blog switch back to english after the update and how can I change that? It used to be “kommentar” before the update:

Thank you so much.
Best,
Peri

Hey Peri,

How did you translated your site? Are you using a translation plugin or simply used the .pot file and translated it to German? Please be advised that all translation should be done within the child theme so that when there is an update, it will not be overwritten. I am guessing that all your translation took place in the parent theme which is why when you updated it, the “kommentar” switch back to English.

Could you please give further clarification as to how did you translated “leave a comment” before?

Kindly let us know.

Hi there:
I actually used the child x theme functions.php for the translation. This ist the code that I entered there:

add_filter(‘gettext’, ‘translate_text_to_german’, 20, 3);

function translate_text_to_german($ttxt, $txt, $d) {

switch ($txt) {
case ‘Submit’:
return ‘Absenden’; break;
case ‘Read More’:
return ‘weiterlesen >’; break;
case ‘%s Comments’:
return ‘Kommentar’; break;
}

return $ttxt;
}
add_action( ‘after_setup_theme’, ‘load_child_language’ );
function load_child_language() {
load_child_theme_textdomain( ‘x’, get_stylesheet_directory() . ‘/languages’ );
}

However, it is does seem to work properly anymore since the update.

Thanks for your support and have a great weekend
Peri

Hello There,

Could you please update the code and use this:

function custom_text_translate($translated) { 
 
  $translated = str_ireplace('Submit', 'Absenden', $translated);
  $translated = str_ireplace('Read More', 'weiterlesen >', $translated);
  $translated = str_ireplace('%s Comments', 'Kommentar', $translated);
  return $translated; 
}
add_filter('gettext', 'custom_text_translate' );

Clear your plugin cache or purge your site cache if you are using any, clear your browser cache or use private browsing mode and test again.

Please let us know how it goes.

Thanks very much for your reply. I have deleted the former code and have replaced it with the new one you have suggested, however, no change. “Leave a comment” still is not being translated and now the “read more” is missing the little arrow “>”, at least it does not show with the new code.

Any more ideas what I can do? Thanks so much for your kind help.

Best,
Peri

Hi there,

I suggest that as it is not working for you, you use the standard way of the translation for the theme. Please use this guide for the details:

Thank you.

Thank you for our reply.

I actually did try that standard way of translating the site the very first time I took care of the translation and it did not work for me, that’s why I chose the alternative that was working fine until the update. Is there really no other way to get that one sentence translated. It seems to just be the line “leave a comment”. All else is still translated. I cab try this standard version again, however, I remember that it did not work for me the first time I tried to do it that way.

Thanks & kind regards!

Let us know how it goes. thanks!

Hi there:

I am sorry to say that it did not work either. Any other options?
Thanks!

Hi There,

Can you update the code to

function custom_text_translate($translated) { 
 
  $translated = str_ireplace('Submit', 'Absenden', $translated);
  $translated = str_ireplace('Read More', 'weiterlesen >', $translated);
  $translated = str_ireplace('%s Comments', 'Kommentar', $translated);
  $translated = str_ireplace('Leave a comment', 'Kommentar', $translated);  
  return $translated; 
}
add_filter('gettext', 'custom_text_translate' );

And check if it works. I just added a line to translate the “Leave a comment” to “Kommentar”.

Hope it works.

Wow! Thank you that did the trick! Thanks so much - the only thing that does not seem to work is the little “>” with the “read more” “weiterlesen >” translation. Any idea why that arrow does not show? It would be so perfect if that would be visible again, too. But I am already super happy that “leave a comment” is back to “Kommentar”. You have made my day! :smile:

Hi there,

Please try to update this line:

$translated = str_ireplace('Read More', 'weiterlesen >', $translated);

to

$translated = str_ireplace('Read More', 'weiterlesen &gt;', $translated);

Hope this helps.

Hi Jade,

Thanks for the suggestion! Just tried it out. Did not create the desired effect. Would there be still another option that I can try out? Thank you so much.

Best

Hi There,

Try this.

function custom_text_translate($translated) { 
 
  $translated = str_ireplace('Submit', 'Absenden', $translated);
  $translated = str_ireplace('Read More', 'weiterlesen >', $translated);
  $translated = str_ireplace('%s Comments', 'Kommentar', $translated);
  $translated = str_ireplace('Leave a comment', 'Kommentar', $translated);  
  $translated = str_ireplace('Weiterlesen', 'Weiterlesen >', $translated);

  return $translated; 
}
add_filter('gettext', 'custom_text_translate' );

Hope it works.

Yes!!! It worked! Thank you so much. Very grateful for your help. :grin:

Best,
Peri

Glad to hear it! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.