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

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

  1. Don comments:

    As the world wide web continues to evolve and change the same is true thee way that you shop.

    And whilst the youngest could have been enjjoying the joys of being a
    crowd “favorite”, the middle child can also feel that he isn’t specijal at all. It might be called as the 1st impression with a customer.

    Alsoo visit my weblog; sell paper money

  2. Beulah comments:

    It’s going to be ending of mine day, except before end I
    am reading this impressive paragraph to improve my experience.

    My site การ์ตูนโดจิน

  3. Garnet comments:

    Hello There. Ifound yourr weblog using msn. That is a very smardtly written article.

    I will make sure Wax To ejuice bookmark it
    and return to read extra of your helpful information. Thank you for the post.
    I will definitely comeback.

  4. Jenifer comments:

    You are so cool! I do not think I’ve truly read through a single
    thing like that before. So nice shatter to vae juice;
    Cornell, find someone
    with a few unique thoughts on this topic. Really.. thanks for starting this up.
    This site is one thing that iss required on the
    web, someone with some originality!

  5. Velma comments:

    Good article. I will be facing some of these issues as well..

    my weblog bondage gear (Vanessa)

  6. Elissa comments:

    great post, very informative. I’m wondering why
    the other experts of this sector do not realize this.
    You must proceed your writing. I am confident, you’ve a huge readers’
    base already!

    my blog – Airbnb Coupon

  7. Micheal comments:

    We absolutely love your blog Travel tips, how tos and information find
    the majority off your post’s to be exactly I’m looking for.
    Would you offer guest writers to write content for you?
    I wouldn’t mind producing a post or elaborating
    on some of the subjects you write concerning here.
    Again, awesome web log!

  8. Thalia comments:

    Wow, that’s what I was exploring for, what a information! present here at this web site,
    thanks admin of this site.

    my web blog finding your acting voice

  9. Avis comments:

    Excellent blog! Do you have any ttips for aspiring writers?

    I’m hoping to start my own sitye soon but I’m a little lost on everything.
    Would you suggeest starting with a Oil Free Moisturizer platform like
    Wordpress oor go for a paid option? There are so many choices out there that I’m completely overwhelmed
    .. Any ideas? Many thanks!

  10. Sagive SEI comments:

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

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

  12. Tom Durkin comments:

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

    thanks a lot!

  13. 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!

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

  15. 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');

  16. Chris comments:

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

  17. 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?

  18. 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)

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

*