-
AuthorPosts
-
April 18, 2014 at 2:19 pm #34863
Hi Themeco crew,
This is my first time with wordpress and within 1 day i got a little site running with your theme. Truly amazing!
Got a question though… The “Read More” button that appears at the blog loop page i would like to translate into Dutch to “Lees verder”.
How can i do this? Excuse me for my n00b question hehe.
Amazing work guys, thanks!
PercyApril 18, 2014 at 7:36 pm #34973Hi there!
Thank you for using the theme!
You can find the code on framework > functions > global > content.php. Look for this code:
if ( ! function_exists( 'x_content_string' ) ) : function x_content_string( $more ) { $stack = x_get_stack(); if ( $stack == 'integrity' ) { return '<a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>'; } else if ( $stack == 'renew' ) { return '<a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>'; } else if ( $stack == 'icon' ) { return '<a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>'; } } add_filter( 'the_content_more_link', 'x_content_string' ); endif;
I hope that helps. Cheers!
April 19, 2014 at 5:52 am #35082Ah, i have to dive into the code. Thanks for the help, found it.
Cheers
April 19, 2014 at 5:49 pm #35210Hi Percy,
You’re welcome! Enjoy coding 🙂
May 4, 2014 at 8:55 am #40373hy,if i use child theme where i must put this file?
thank you
May 4, 2014 at 5:34 pm #40461Hi Marius,
You could put your content.php under x-child-{YOUR_STACK}/framework/functions/global/.
Hope this helps.
May 4, 2014 at 6:41 pm #40475thanks for your answer but allready try in that location and is not working.
May 4, 2014 at 9:08 pm #40544Hi there!
Thank you for using the theme!
To make this easier, please add this on the child theme’s functions.php:
function x_child_excerpt_string( $more ) { $stack = x_get_stack(); if ( $stack == 'integrity' ) { return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Lees Verder', '__x__' ) . '</a></div>'; } else if ( $stack == 'renew' ) { return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Lees Verder', '__x__' ) . '</a>'; } else if ( $stack == 'icon' ) { return ' ...'; } } add_filter( 'excerpt_more', 'x_child_excerpt_string' );
Hope this helps. Cheers!
May 7, 2014 at 8:36 am #41499does not work with function also..:(
May 7, 2014 at 7:00 pm #41902Hi Ioel,
Sorry for the confusion, child theme templates will only work for “framework/views” structure, and not for “framework/functions”. Functions.php should work too, but there are many possible reason why it wont take effect.
1. You could clear your plugin’s cache.
2. Could you disable jetpack if available.
3. Filter is called earlier than default filter builtin to X.So you might need to change
add_filter( 'excerpt_more', 'x_child_excerpt_string' );
into
add_filter( 'excerpt_more', 'x_child_excerpt_string', 9999 );
4. __() was overridden.
So, you need to add this to you child theme’s functions.php
add_filter( 'gettext', 'x_translate_read_more', 9999, 3 ); function x_translate_read_more( $translated, $text, $domain ) { if($text=='Read More') return 'Lees Verder'; else return $translated; }
But if you want to change lot of text, then you could use manual string translation plugin.
Hope this helps.
May 9, 2014 at 7:32 am #42549great, works with your code.
thank you.
May 10, 2014 at 2:23 pm #42942You’re welcome!
November 21, 2014 at 1:52 am #149692How can I change the above code so that it will only change the above for the NL version of the website. I am using WPML but I cannot find the string Read more in stringtranslation so I am looking for another solution.
November 21, 2014 at 3:37 pm #150192Hi Webgirl,
Could you try this one? 🙂
add_filter( 'gettext', 'x_translate_read_more', 9999, 3 ); function x_translate_read_more( $translated, $text, $domain ) { if($text=='Read More' && ICL_LANGUAGE_CODE == 'nl' ) return 'Lees Verder'; else return $translated; }
Hope this helps.
November 27, 2014 at 2:30 am #153797Perfect, thanks!
-
AuthorPosts