- This topic has 13 replies, 3 voices, and was last updated 9 years, 1 month ago by Tom.
-
AuthorPosts
-
October 14, 2014 at 3:34 am #39059Martin Kirst
Hey there,
I’m using Polylang together with GeneratePress. I noticed that the …Read more… link is not translated into my language of choice. It just remains in English language. Any suggestions how I can fix this?
Thanks in advance!
Martin
October 14, 2014 at 9:52 am #39128TomLead DeveloperLead DeveloperHi Martin,
I assume you’re using the Blog addon?
If so, you can add your own read more text in the Customizer in the “Blog” section.
October 14, 2014 at 12:11 pm #39164Martin KirstYes, you are right. Well, nice feature, but I actually have a multilingual site. Is there a way to have different translations for the different languages of my site? This would be great.
Thanks for fast support, so far.
October 14, 2014 at 12:14 pm #39165TomLead DeveloperLead DeveloperYou’ve given me a reason to make it translatable π
It will be translatable in the next version.
Thanks!
October 14, 2014 at 12:17 pm #39166Martin KirstOh, nice. So, okay then I wait for the next version. π
Many thanks.
March 19, 2015 at 5:38 am #88588Erlend Magnus ViggenHi Tom,
I also use the Polylang plugin with GeneratePress, and in the recent update I saw that “Read more” now automatically is translated to the Norwegian “Les mer”. Nice!
However, I’ve subsequently bought the Blog add-on, and the “Read more label” field in the “Blog content” customisation pane overrules this particular translation feature. No longer is the read more label translated; instead it’s given as specified in that field for both the Norwegian and English versions of the blog. Is there any quick and easy way to fix that?
Cheers,
ErlendMarch 19, 2015 at 12:57 pm #88822TomLead DeveloperLead DeveloperHmm good point, I think the easiest way to fix this would be to make the setting in the Blog Content area stop working.
Try this code:
add_action('after_setup_theme','generate_remove_blog_filters'); function generate_remove_blog_filters() { remove_filter( 'excerpt_more', 'generate_blog_excerpt_more', 99 ); remove_filter( 'the_content_more_link', 'generate_blog_content_more', 99 ); }
You can add it in your child theme’s functions.php file, or using a plugin like this: https://wordpress.org/plugins/code-snippets/
The above should make the theme revert back to the translatable Read more text.
Let me know π
March 20, 2015 at 3:30 am #89030Erlend Magnus ViggenHi, and thank you very much for the quick answer!
I’ve added the code snippet to the functions.php file in the child theme directory on our server, but it had no discernible effect. The “Read more label” field in the Blog Content area is still there, and it still controls the “read more” label just like it did before I added the snippet. Any ideas on what could be wrong?
March 21, 2015 at 7:22 pm #89539TomLead DeveloperLead DeveloperHi there,
Very weird – just tested it on my server. It made it so changing the option in the Customizer does nothing, and when I switch languages, the read more link is translated.
Can you make sure your child theme is activated, then maybe clear your browser cache?
Let me know π
March 23, 2015 at 12:08 am #90081Erlend Magnus ViggenHi,
That is weird. I’ve pasted your snippet at the bottom of the functions.php file in your blank child theme, uploaded all the child theme files to wp-content/themes/generatepress-child, checked that the child theme is active, and still the option in the Customiser works perfectly. I’ve tested this in both Firefox and IE. Clearing my browser cache did nothing. Both Polylang and GeneratePress got updates over the weekend, but those didn’t affect this issue either.
It’s weird that it should work for you but not me. Disabling the Blog add-on removes the problem, but of course I would very much like to be able to use that add-on… π
This is not super urgent, though; we can make do with this tiny language hiccup on our blog for the time being.
Cheers,
ErlendMarch 23, 2015 at 10:13 am #90321TomLead DeveloperLead DeveloperCan you possibly email me temporary admin login details to support@generatepress.com so I can take a look?
Thanks!
March 26, 2015 at 10:06 am #91750TomLead DeveloperLead DeveloperGot it, here’s the code that ended up working for you:
if ( ! function_exists( 'generate_translate_excerpt_more' ) ) : /** * Prints the read more HTML to post excerpts */ add_filter( 'excerpt_more', 'generate_translate_excerpt_more', 100 ); function generate_translate_excerpt_more( $more ) { return ' ... <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . __('Read more', 'generate') . '</a>'; } endif; if ( ! function_exists( 'generate_translate_content_more' ) ) : /** * Prints the read more HTML to post content using the more tag */ add_filter( 'the_content_more_link', 'generate_translate_content_more', 100 ); function generate_translate_content_more( $more ) { return '<p><a class="read-more content-read-more" href="'. get_permalink( get_the_ID() ) . '">' . __('Read more', 'generate') . '</a></p>'; } endif;
March 27, 2015 at 12:42 am #91957Erlend Magnus ViggenThank you very much Tom, this works brilliantly!
March 27, 2015 at 9:02 am #92216TomLead DeveloperLead DeveloperYou’re welcome! π
-
AuthorPosts
- You must be logged in to reply to this topic.