-
AuthorPosts
-
March 9, 2020 at 3:26 pm #1191550
Hi team :)
I’m using these two snippets in my template-builder.php, to show social share and related post, at the end of blog posts:
======================
//show social share on single blog posts
if(is_singular(‘post’)) {
echo do_shortcode(“[av_social_share title=".__('Share this entry','avia_framework')." style='' buttons='' share_facebook='' share_twitter='' share_pinterest='' share_reddit='' share_linkedin='' share_tumblr='' share_vk='' share_mail='' av-desktop-hide='' av-medium-hide='' av-small-hide='' av-mini-hide='']“);
// end social share//show related posts based on tags if there are any
get_template_part( ‘includes/related-posts’);
// end related posts
}
======================But I’m having an issue with the texts inserted not following the language files in use. So the first block will say “Share” and the second “You might also like” – no matter what language is used :(
Can you tell me how to adapt the script to match the language in question?
Thanks :)
ThomasMarch 10, 2020 at 6:23 pm #1191961Hey autopilotdk,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaMarch 11, 2020 at 8:32 am #1192169This reply has been marked as private.March 12, 2020 at 7:44 pm #1192728Hi autopilotdk,
Looks like this file is missing this translation
enfold/lang/da_DK.poYou can edit the file and add your translation there.
If you need further assistance please let us know.
Best regards,
VictoriaMarch 12, 2020 at 11:10 pm #1192800Hi Victoria!
That’s really weird. When I download the da_dk.po file and review it in Poedit, the translations are there:
Are we looking at the same thing? Or aren’t those the right fields ?
Best regards,
ThomasMarch 15, 2020 at 8:44 pm #1193276Hi Thomas,
Hmm.. that’s very weird. Can you remove the code form the child theme and see if it’s going to get translated? You can just comment it out for the test.
If you need further assistance please let us know.
Best regards,
VictoriaMarch 16, 2020 at 3:17 pm #1193500Hi Victoria.
I’m afraid I don’t follow. :/
If I remove this:
//show social share on single blog posts if(is_singular(‘post’)) { echo do_shortcode(“[av_social_share title=".__('Share this entry','avia_framework')." style='' buttons='' share_facebook='' share_twitter='' share_pinterest='' share_reddit='' share_linkedin='' share_tumblr='' share_vk='' share_mail='' av-desktop-hide='' av-medium-hide='' av-small-hide='' av-mini-hide='']“); // end social share //show related posts based on tags if there are any get_template_part( ‘includes/related-posts’); // end related posts }
from template-builder.php nothing gets translated, because there’s nothing to see. No “Share” block and no “You might also like” block…
Am I missing something here?
/Thomas
March 16, 2020 at 9:14 pm #1193640Hi Thomas,
Oh, sorry, I meant if you have a pos built with the classic editor do those things get translated?
Best regards,
VictoriaMarch 16, 2020 at 9:29 pm #1193654Hi Victoria.
Ahh, that makes more sense :D
I’ve published a post built without clicking “advanced layout editor”
It’s in Danish (html lang=”da-DK”), but the Share and You might also like texts appear in English.
March 19, 2020 at 5:45 pm #1194481Hi autopilotdk,
Hmmm…. Lools like this was an issue before:
https://kriesi.at/support/topic/share-this-entry-is-not-being-translated/Did you update the footer.php with a fresh copy?
Best regards,
VictoriaMarch 20, 2020 at 3:45 pm #1194809Hi Victoria!
Well, it hadn’t occurred to me that the footer.php would influence translations in main content. Don’t you mean functions.php?
If I add this to functions.php, it works for the “Share” text:
add_filter('avia_social_share_title','av_translate_social_share_title'); function av_translate_social_share_title() { if (get_locale() == 'da_DK') { return "Share this entry in Danish"; } }
Do you have a similar fix for “You might also like” text?
Thanks.
Thomas- This reply was modified 4 years, 10 months ago by autopilotdk.
March 20, 2020 at 8:21 pm #1194916Hi Thomas,
Well, unfortunately, there is no filter around that text, you can add the check in the file yourself. Here /includes/related-posts.php
The footer file has the closing body tag and some scripts are added there and anyway, all files in the child theme have to be updated manually when the parent theme updates.
Best regards,
VictoriaMarch 23, 2020 at 10:15 am #1195398Hi Victoria!
Awesome, thanks for the help :) I’ve included language sensitive headlines in related-posts.php and it works.
Now that we’re getting the “you might also likes” up and running, I notice that recommendations are made across languages. So an English post might recommend a Danish post. Can we change that, so users are only recommended posts in their chosen language?
Example in English, recommending Danish post:
Thanks in advance :)
ThomasMarch 26, 2020 at 1:59 pm #1198021Hi autopilotdk,
Glad you got that part working :)
https://share.getcloudapp.com/geu2DJdE I guess you need to add the right categories and languages to the posts.
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.