Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1354308

    Hello, under all my blog items there is a “Read more” button (which I want to keep). But I want to change the text “read more” in something else.

    How can I do that in my Child theme (so that it is not changed back after an update)/

    Thanks for your help :)

    Best Wishes,
    Alwin

    #1354352

    You can of course edit all loop files that are affected and upload them as child-theme files.
    Unfortunately, this is quite a lot of places to change, due to the fact that we have different cases here.
    (Business-, Elegant-, Business-modern Blog) and that in loop-index.php, loop-portfolio-single.php etc.

    but you can try this substitution via gettext:

    function my_text_strings( $translated_text, $text, $domain ){
    switch ( $translated_text ){
        case 'Read more'    :  $translated_text = __( 'Read more of it', $domain ); break;
         // in case you got different languages on your page and want to change them too:
        case 'Weiterlesen'  :  $translated_text = __( 'Mehr über das Thema …', $domain ); break;
      }
      return $translated_text;
    }
    add_filter('gettext', 'my_text_strings', 20, 3);
    #1355027

    Thank you Guenni007,

    – Do I have to place your code in my Child themes functions.php file?

    – I don’t have different languages on my page, so I can skip that part of the code?

    The text needs to be translated in German; “Mehr lesen”. So would it have to be like this:

    function my_text_strings( $translated_text, $text, $domain ){
    switch ( $translated_text ){
        case 'Read more'    :  $translated_text = __( 'Mehr lesen', $domain ); break;
    
      }
      return $translated_text;
    }
    add_filter('gettext', 'my_text_strings', 20, 3);
    

    Thanks a lot again :)

    Best Wishes,
    Alwin

    #1355038

    Yes for child-theme functions.php
    and this second line was only meant to show how further substitutions have to be set. Important is the break setting after each line.
    – However, if you had asked for a different language translation ( f.e. the german translation of the read more phrase) , I probably would have recommended editing the lang file. Again, you could find a child theme solution.

    #1355049

    I added the code to my fuctions.php and it’s working fine!

    Thank you again 007 :)

    Alwin

    #1355056

    Hi,

    Great, I’m glad that @guenni007 could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.