Skip to content
Advertisement

Change “Read More” text in WordPress Divi theme

I’m creating a page using the Divi theme in my WordPress site. I want to change the “read more” text in my posts to “Read Article ->”.

I tried to use a tutorial from the elegant themes blog but it didn’t work.

(https://www.elegantthemes.com/blog/tips-tricks/how-to-customize-the-wordpress-read-more-link-text)

How can I change the text using php ? (Not JavaScript)

posts screenshot

Thanks

Advertisement

Answer

You are using divi builder. The read more text is in /divi-builder/includes/builder/module/Blog.php at line number 1197

To change this readmore we can use wordpress gettext filter ( http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext )

Add the following code to your themes functions.php file and it will solve your issue.

function my_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
        case 'read more' :
            $translated_text = __( 'read more ->', 'et_builder' );
            break;
    }
    return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );

I already tested the code in one of my wordpress site. its working.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement