Change “Read More” text in Wordpress Divi theme
up vote
0
down vote
favorite
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)

Thanks
php wordpress
add a comment |
up vote
0
down vote
favorite
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)

Thanks
php wordpress
Can you give the link of your webpage and tell us exactly which read more text you are trying to modify.
– Mash R.
Nov 12 at 14:09
link to the site: dearsystems.chornatastudio.com/inventory-software/home/features/… I added screenshot to my question
– Taras Chernata
Nov 12 at 14:11
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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)

Thanks
php wordpress
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)

Thanks
php wordpress
php wordpress
edited Nov 12 at 14:17
Universal Link
12912
12912
asked Nov 12 at 13:56
Taras Chernata
287
287
Can you give the link of your webpage and tell us exactly which read more text you are trying to modify.
– Mash R.
Nov 12 at 14:09
link to the site: dearsystems.chornatastudio.com/inventory-software/home/features/… I added screenshot to my question
– Taras Chernata
Nov 12 at 14:11
add a comment |
Can you give the link of your webpage and tell us exactly which read more text you are trying to modify.
– Mash R.
Nov 12 at 14:09
link to the site: dearsystems.chornatastudio.com/inventory-software/home/features/… I added screenshot to my question
– Taras Chernata
Nov 12 at 14:11
Can you give the link of your webpage and tell us exactly which read more text you are trying to modify.
– Mash R.
Nov 12 at 14:09
Can you give the link of your webpage and tell us exactly which read more text you are trying to modify.
– Mash R.
Nov 12 at 14:09
link to the site: dearsystems.chornatastudio.com/inventory-software/home/features/… I added screenshot to my question
– Taras Chernata
Nov 12 at 14:11
link to the site: dearsystems.chornatastudio.com/inventory-software/home/features/… I added screenshot to my question
– Taras Chernata
Nov 12 at 14:11
add a comment |
3 Answers
3
active
oldest
votes
up vote
2
down vote
accepted
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.
Thanks)) your code is working for me perfectly, but can I somehow add an image to the text ( arrow image ) ?
– Taras Chernata
Nov 13 at 8:22
add a comment |
up vote
1
down vote
Are multiple ways to do that:
1. Using Jquery
In your WordPress dashboard navigate to Divi>Theme Options>Integration and add code below to the “Body ” field. Note: Make sure the “Enable Body Code” switch is on.
<script type="text/javascript">
(function($) {
$(document).ready(function() {
var newVal = 'Read Article';
$('.more-link').html( newVal );
});
})(jQuery);
</script>
2. Adding this code in theme functions.php file
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full
article...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
If you are using a Child Theme, the above code will not work without modification if the parent theme has its own filters setting its own "more" link. You will need to use the remove_filter() function to remove the parent's filters for yours to work. The problem is your functions.php file is loaded before the parent's functions.php, so at the time of your file's execution, there is no filter to remove yet, and your remove_filter() code will fail without warning.
The key is to put your remove_filter() code in a function that executes from an action hook that triggers after the parent theme is loaded. The following code is an example of the additional code needed to get the above code to work from a child theme of the parent Divi theme. You will need to examine your actual parent theme's code for the correct parameters in the remove_filter() code, they must exactly match the add_filter() parameters used by the parent.
function child_theme_setup() {
// override parent theme's 'more' text for excerpts
remove_filter( 'excerpt_more', 'divi_auto_excerpt_more' );
remove_filter( 'get_the_excerpt', 'divi_custom_excerpt_more' );
}
add_action( 'after_setup_theme', 'child_theme_setup' );
Hello Ovidiu! Thanks a lot, your explanation is very clear) I tried your code but unfortunatelly it doesn't work, I can't understand why, I added the code to my function.php in child theme (also I use "multisite" in my wordpress)
– Taras Chernata
Nov 12 at 18:20
I don't need to use "remove_filter"
– Taras Chernata
Nov 12 at 18:24
@TarasChernata , this code won't work for you. Its because the page you are trying to modify is not a wordpress blog category page. Your page is created using divi builder plugin and the blog section is a module by divi builder plugin.
– Mash R.
Nov 12 at 21:03
add a comment |
up vote
0
down vote
Maybe you can use the plugin Loco Translate
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263693%2fchange-read-more-text-in-wordpress-divi-theme%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
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.
Thanks)) your code is working for me perfectly, but can I somehow add an image to the text ( arrow image ) ?
– Taras Chernata
Nov 13 at 8:22
add a comment |
up vote
2
down vote
accepted
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.
Thanks)) your code is working for me perfectly, but can I somehow add an image to the text ( arrow image ) ?
– Taras Chernata
Nov 13 at 8:22
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
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.
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.
edited Nov 12 at 14:42
James Ives
1,3591332
1,3591332
answered Nov 12 at 14:39
Mash R.
1,2291614
1,2291614
Thanks)) your code is working for me perfectly, but can I somehow add an image to the text ( arrow image ) ?
– Taras Chernata
Nov 13 at 8:22
add a comment |
Thanks)) your code is working for me perfectly, but can I somehow add an image to the text ( arrow image ) ?
– Taras Chernata
Nov 13 at 8:22
Thanks)) your code is working for me perfectly, but can I somehow add an image to the text ( arrow image ) ?
– Taras Chernata
Nov 13 at 8:22
Thanks)) your code is working for me perfectly, but can I somehow add an image to the text ( arrow image ) ?
– Taras Chernata
Nov 13 at 8:22
add a comment |
up vote
1
down vote
Are multiple ways to do that:
1. Using Jquery
In your WordPress dashboard navigate to Divi>Theme Options>Integration and add code below to the “Body ” field. Note: Make sure the “Enable Body Code” switch is on.
<script type="text/javascript">
(function($) {
$(document).ready(function() {
var newVal = 'Read Article';
$('.more-link').html( newVal );
});
})(jQuery);
</script>
2. Adding this code in theme functions.php file
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full
article...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
If you are using a Child Theme, the above code will not work without modification if the parent theme has its own filters setting its own "more" link. You will need to use the remove_filter() function to remove the parent's filters for yours to work. The problem is your functions.php file is loaded before the parent's functions.php, so at the time of your file's execution, there is no filter to remove yet, and your remove_filter() code will fail without warning.
The key is to put your remove_filter() code in a function that executes from an action hook that triggers after the parent theme is loaded. The following code is an example of the additional code needed to get the above code to work from a child theme of the parent Divi theme. You will need to examine your actual parent theme's code for the correct parameters in the remove_filter() code, they must exactly match the add_filter() parameters used by the parent.
function child_theme_setup() {
// override parent theme's 'more' text for excerpts
remove_filter( 'excerpt_more', 'divi_auto_excerpt_more' );
remove_filter( 'get_the_excerpt', 'divi_custom_excerpt_more' );
}
add_action( 'after_setup_theme', 'child_theme_setup' );
Hello Ovidiu! Thanks a lot, your explanation is very clear) I tried your code but unfortunatelly it doesn't work, I can't understand why, I added the code to my function.php in child theme (also I use "multisite" in my wordpress)
– Taras Chernata
Nov 12 at 18:20
I don't need to use "remove_filter"
– Taras Chernata
Nov 12 at 18:24
@TarasChernata , this code won't work for you. Its because the page you are trying to modify is not a wordpress blog category page. Your page is created using divi builder plugin and the blog section is a module by divi builder plugin.
– Mash R.
Nov 12 at 21:03
add a comment |
up vote
1
down vote
Are multiple ways to do that:
1. Using Jquery
In your WordPress dashboard navigate to Divi>Theme Options>Integration and add code below to the “Body ” field. Note: Make sure the “Enable Body Code” switch is on.
<script type="text/javascript">
(function($) {
$(document).ready(function() {
var newVal = 'Read Article';
$('.more-link').html( newVal );
});
})(jQuery);
</script>
2. Adding this code in theme functions.php file
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full
article...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
If you are using a Child Theme, the above code will not work without modification if the parent theme has its own filters setting its own "more" link. You will need to use the remove_filter() function to remove the parent's filters for yours to work. The problem is your functions.php file is loaded before the parent's functions.php, so at the time of your file's execution, there is no filter to remove yet, and your remove_filter() code will fail without warning.
The key is to put your remove_filter() code in a function that executes from an action hook that triggers after the parent theme is loaded. The following code is an example of the additional code needed to get the above code to work from a child theme of the parent Divi theme. You will need to examine your actual parent theme's code for the correct parameters in the remove_filter() code, they must exactly match the add_filter() parameters used by the parent.
function child_theme_setup() {
// override parent theme's 'more' text for excerpts
remove_filter( 'excerpt_more', 'divi_auto_excerpt_more' );
remove_filter( 'get_the_excerpt', 'divi_custom_excerpt_more' );
}
add_action( 'after_setup_theme', 'child_theme_setup' );
Hello Ovidiu! Thanks a lot, your explanation is very clear) I tried your code but unfortunatelly it doesn't work, I can't understand why, I added the code to my function.php in child theme (also I use "multisite" in my wordpress)
– Taras Chernata
Nov 12 at 18:20
I don't need to use "remove_filter"
– Taras Chernata
Nov 12 at 18:24
@TarasChernata , this code won't work for you. Its because the page you are trying to modify is not a wordpress blog category page. Your page is created using divi builder plugin and the blog section is a module by divi builder plugin.
– Mash R.
Nov 12 at 21:03
add a comment |
up vote
1
down vote
up vote
1
down vote
Are multiple ways to do that:
1. Using Jquery
In your WordPress dashboard navigate to Divi>Theme Options>Integration and add code below to the “Body ” field. Note: Make sure the “Enable Body Code” switch is on.
<script type="text/javascript">
(function($) {
$(document).ready(function() {
var newVal = 'Read Article';
$('.more-link').html( newVal );
});
})(jQuery);
</script>
2. Adding this code in theme functions.php file
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full
article...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
If you are using a Child Theme, the above code will not work without modification if the parent theme has its own filters setting its own "more" link. You will need to use the remove_filter() function to remove the parent's filters for yours to work. The problem is your functions.php file is loaded before the parent's functions.php, so at the time of your file's execution, there is no filter to remove yet, and your remove_filter() code will fail without warning.
The key is to put your remove_filter() code in a function that executes from an action hook that triggers after the parent theme is loaded. The following code is an example of the additional code needed to get the above code to work from a child theme of the parent Divi theme. You will need to examine your actual parent theme's code for the correct parameters in the remove_filter() code, they must exactly match the add_filter() parameters used by the parent.
function child_theme_setup() {
// override parent theme's 'more' text for excerpts
remove_filter( 'excerpt_more', 'divi_auto_excerpt_more' );
remove_filter( 'get_the_excerpt', 'divi_custom_excerpt_more' );
}
add_action( 'after_setup_theme', 'child_theme_setup' );
Are multiple ways to do that:
1. Using Jquery
In your WordPress dashboard navigate to Divi>Theme Options>Integration and add code below to the “Body ” field. Note: Make sure the “Enable Body Code” switch is on.
<script type="text/javascript">
(function($) {
$(document).ready(function() {
var newVal = 'Read Article';
$('.more-link').html( newVal );
});
})(jQuery);
</script>
2. Adding this code in theme functions.php file
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full
article...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
If you are using a Child Theme, the above code will not work without modification if the parent theme has its own filters setting its own "more" link. You will need to use the remove_filter() function to remove the parent's filters for yours to work. The problem is your functions.php file is loaded before the parent's functions.php, so at the time of your file's execution, there is no filter to remove yet, and your remove_filter() code will fail without warning.
The key is to put your remove_filter() code in a function that executes from an action hook that triggers after the parent theme is loaded. The following code is an example of the additional code needed to get the above code to work from a child theme of the parent Divi theme. You will need to examine your actual parent theme's code for the correct parameters in the remove_filter() code, they must exactly match the add_filter() parameters used by the parent.
function child_theme_setup() {
// override parent theme's 'more' text for excerpts
remove_filter( 'excerpt_more', 'divi_auto_excerpt_more' );
remove_filter( 'get_the_excerpt', 'divi_custom_excerpt_more' );
}
add_action( 'after_setup_theme', 'child_theme_setup' );
answered Nov 12 at 14:37
Ovidiu Barzaghideanu
863
863
Hello Ovidiu! Thanks a lot, your explanation is very clear) I tried your code but unfortunatelly it doesn't work, I can't understand why, I added the code to my function.php in child theme (also I use "multisite" in my wordpress)
– Taras Chernata
Nov 12 at 18:20
I don't need to use "remove_filter"
– Taras Chernata
Nov 12 at 18:24
@TarasChernata , this code won't work for you. Its because the page you are trying to modify is not a wordpress blog category page. Your page is created using divi builder plugin and the blog section is a module by divi builder plugin.
– Mash R.
Nov 12 at 21:03
add a comment |
Hello Ovidiu! Thanks a lot, your explanation is very clear) I tried your code but unfortunatelly it doesn't work, I can't understand why, I added the code to my function.php in child theme (also I use "multisite" in my wordpress)
– Taras Chernata
Nov 12 at 18:20
I don't need to use "remove_filter"
– Taras Chernata
Nov 12 at 18:24
@TarasChernata , this code won't work for you. Its because the page you are trying to modify is not a wordpress blog category page. Your page is created using divi builder plugin and the blog section is a module by divi builder plugin.
– Mash R.
Nov 12 at 21:03
Hello Ovidiu! Thanks a lot, your explanation is very clear) I tried your code but unfortunatelly it doesn't work, I can't understand why, I added the code to my function.php in child theme (also I use "multisite" in my wordpress)
– Taras Chernata
Nov 12 at 18:20
Hello Ovidiu! Thanks a lot, your explanation is very clear) I tried your code but unfortunatelly it doesn't work, I can't understand why, I added the code to my function.php in child theme (also I use "multisite" in my wordpress)
– Taras Chernata
Nov 12 at 18:20
I don't need to use "remove_filter"
– Taras Chernata
Nov 12 at 18:24
I don't need to use "remove_filter"
– Taras Chernata
Nov 12 at 18:24
@TarasChernata , this code won't work for you. Its because the page you are trying to modify is not a wordpress blog category page. Your page is created using divi builder plugin and the blog section is a module by divi builder plugin.
– Mash R.
Nov 12 at 21:03
@TarasChernata , this code won't work for you. Its because the page you are trying to modify is not a wordpress blog category page. Your page is created using divi builder plugin and the blog section is a module by divi builder plugin.
– Mash R.
Nov 12 at 21:03
add a comment |
up vote
0
down vote
Maybe you can use the plugin Loco Translate
add a comment |
up vote
0
down vote
Maybe you can use the plugin Loco Translate
add a comment |
up vote
0
down vote
up vote
0
down vote
Maybe you can use the plugin Loco Translate
Maybe you can use the plugin Loco Translate
answered Nov 12 at 14:42
Dennis Perremans
12311
12311
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263693%2fchange-read-more-text-in-wordpress-divi-theme%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you give the link of your webpage and tell us exactly which read more text you are trying to modify.
– Mash R.
Nov 12 at 14:09
link to the site: dearsystems.chornatastudio.com/inventory-software/home/features/… I added screenshot to my question
– Taras Chernata
Nov 12 at 14:11