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
4
Answers
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.
2. Adding this code in theme functions.php file
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.
You are using divi builder. The read more text is in
/divi-builder/includes/builder/module/Blog.php
at line number 1197To 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.
I already tested the code in one of my wordpress site. its working.
Maybe you can use the plugin Loco Translate
jQuery way with ajax pagination: