32 | Changing the ‘Read more’ in Twenty Ten Child Theme

g+

To change the ‘read more’ text in a child theme of Twenty Ten, one needs to add a few lines to functions.php of the child theme.

This procedure uses a method that I came across in an introductory article about programming a child theme of Twenty Ten, by Aaron Jorbin, who himself was building upon Mangling strings for fun and profit, by WordPress lead Developer Peter Westwood.

class Transformation_Text_Wrangler {
function reading_more($translation, $text, $domain) {
$translations = &get_translations_for_domain( $domain );
if ( $text == 'Continue reading <span class="meta-nav">&rarr;</span>' ) {
return $translations->translate( 'Get to know more <span class="meta-nav">&raquo;</span>' );
}
return $translation;
}
}
add_filter('gettext', array('Transformation_Text_Wrangler', 'reading_more'), 10, 4);

This way of customising texts in a child theme is applicable to all the strings of the mother theme.

This entry was posted in Tips & Tricks, WordPress and tagged , , , , , , , , . Bookmark the permalink.

18 Responses to Changing the ‘Read more’ in Twenty Ten Child Theme

  1. Polly comments:

    It’s awesome for me to have a web site, which is valuable in support
    of my knowledge. thanks admin

    my weblog 007카지노 (Hollie)

  2. Wilma comments:

    I’ve been surfing online greater than 3
    houds these days, yet I never discovered any attention-grabbing article like yours.
    It’s beautiful price enough for me. In my opinion, if all webmasters and bloggers made good
    content as you probably did, the internet shall be much more useful than ever before.

    My blog 우리카지노

  3. Sagive SEI comments:

    Very Cool man! worked like a chare 🙂 thanks a lot

  4. Darlene L Janssen comments:

    I am a total newbie and I am trying to have a read more on a page, have done masses of reading but not finding anything. Found code in the codex page but do not know which file to put it in. I am using the twenty ten template and tried, index.php, page.php and others to no avail.

    When I used the read more on the page, it seems to ignore the tag and displays the whole page. Could anyone help me figure this out as this is my very first try and I have spent days and got nowhere.

    This is the code I found but I don’t know wher to put it //

    //

    I really have no idea how to make a child theme so was trying to put it in the theme? Any help would be appreciated.

    • alchymyth replies:

      try to check loop.php and loop-page.php in Twenty Ten. what kind of page are you talking about? a static page. or a archive page? ‘read-more’ and static pages don’t really work together.
      to ask all your wordpress related questions, consider joining the wordpress.org support forum – there are many members who should be able to help you with your problems.

  5. Tom Durkin comments:

    I’ve tried a lot of other solutions with no luck but this works swell!

    thanks a lot!

  6. Peter comments:

    Thanks for this – I spent a day and tried a dozen ideas from Google before I found one that actually works!
    Many thanks!

  7. Enrico comments:

    Hi, how we can styling this function? For example, button background for “Get to know more”, etc etc, or just a different font, etc.

  8. Scott comments:

    Does this also change the “…” before the text of the read more? I’m using this in my child theme as I couldn’t find a way to remove the 3 periods before the text.
    // remove the ... from excerpt and change the text
    function change_excerpt_more()
    {
    function new_excerpt_more($more)
    {
    return '<span class="read-more"><a href="' . get_permalink($post->ID) . '">Read the Rest &raquo;</a></span>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    }
    add_action('after_setup_theme', 'change_excerpt_more');

  9. Chris comments:

    What about if you wanted to have the post title displayed as the link – as in Continue Reading (post title)

  10. Greg Astles comments:

    Thanks, this is great! Question, though.
    I seem to be breaking this with the text I want to place in there. I’d like to add “But wait, there’s more”, but the apostrophe seems to be breaking it. Is there a way have it in there?

  11. smoo comments:

    Thank you so much for this!
    I have been trying for many hours now to make this happen, and compared with everything else I’ve modified in WP, this has been the hardest solution to track down…
    You are a star :o)

  12. Pingback: Twenty Ten: Free Wordpress Theme (and Related Articles) | READMORE.CE.MS

    g+

    03/11/2010 | […] Transformation Power Tools: Changing the ‘Read more’ in Twenty Ten Child Theme […]

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.