Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #34863

    Percy T
    Participant

    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!
    Percy

    #34973

    Support
    Member

    Hi 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!

    #35082

    Percy T
    Participant

    Ah, i have to dive into the code. Thanks for the help, found it.

    Cheers

    #35210

    Rad
    Moderator

    Hi Percy,

    You’re welcome! Enjoy coding 🙂

    #40373

    ioel
    Participant

    hy,if i use child theme where i must put this file?

    thank you

    #40461

    Rad
    Moderator

    Hi Marius,

    You could put your content.php under x-child-{YOUR_STACK}/framework/functions/global/.

    Hope this helps.

    #40475

    ioel
    Participant

    thanks for your answer but allready try in that location and is not working.

    #40544

    Support
    Member

    Hi 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!

    #41499

    ioel
    Participant

    does not work with function also..:(

    #41902

    Rad
    Moderator

    Hi 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.

    #42549

    ioel
    Participant

    great, works with your code.

    thank you.

    #42942

    Rubin
    Keymaster

    You’re welcome!

    #149692

    webgirlliz1
    Participant

    How 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.

    #150192

    Rad
    Moderator

    Hi 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.

    #153797

    webgirlliz1
    Participant

    Perfect, thanks!