WordPress.org

Forums

Frontier
[resolved] Changing read more text? (4 posts)

  1. Ate Up With Motor
    Member
    Posted 1 year ago #

    I'm sorry to bother you with another question. I'm trying to figure out how to modify the read more text (so that it says something other than "more..."). I see how to do it by editing the the_content function in loop-blog.php, but is it possible to do that from the child theme without simply copying the file there?

    Thanks again!

  2. ronangelo
    Member
    Theme Author

    Posted 1 year ago #

    Do you mean the "Continue Reading" button?
    You could change that by adding this on your child-theme's function.php

    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'Continue Reading' ) {
    		$translated_text = 'Read Whole Article';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    As long as a text on the theme is translatable, you can change it through the functions.php http://ronangelo.com/change-or-translate-text-on-a-wordpress-theme/

  3. ronangelo
    Member
    Theme Author

    Posted 1 year ago #

    Oh, I think you mean the "Read more" when using a <!--more--> tag, right?
    You can use this instead.

    function change_more_link( $more_link, $more_link_text ) {
    	return str_replace( $more_link_text, 'Read This', $more_link );
    }
    add_filter( 'the_content_more_link', 'change_more_link', 10, 2 );
  4. Ate Up With Motor
    Member
    Posted 1 year ago #

    That's it exactly. Thank you so much -- I spend most of yesterday trying to get my head around how to set up the code for that!

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic