• I am using WordPress Twenty Twenty theme. So I am trying to change the “Read more” text after each blog and this is the function i am trying to do it with.

    `function modify_read_more_link() {
    return ‘<a class=”more-link” href=”‘ . get_permalink() . ‘”>Your Read More Link Text</a>’;
    }
    add_filter( ‘the_content_more_link’, ‘modify_read_more_link’ );`

    But the text isn’t changing.

    Could there be problems with certain plugins?
    A person has said that the code should work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I plugged that code into the bottom of TwentyTwenty’s functions.php file and it is working for me. Though you’d want to set this up in a child theme to ensure that changes you make aren’t overwritten.

    Have you tried disabling all plugins to see if those are causing any conflicts?

    Thread Starter morshyo

    (@morshyo)

    I disabled all the plugins and added it to the child themes functions.php, it didn’t work.
    Question:
    Is child themes function.php file supposed to have practically no code?

    I tried adding to to main themes function.php, and i got this error.

    Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.

    When i open the console and go to network in chrome and update the functions.php file again, i get this error message from admin-ajax.php

    An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.

    • This reply was modified 5 years, 2 months ago by morshyo.
    • This reply was modified 5 years, 2 months ago by morshyo.
    • This reply was modified 5 years, 2 months ago by morshyo.

    The child theme’s functions.php file can have as much or as little code as you need. If you only want to modify the read more link text you could have just that in the file

    <?php
    
    function modify_read_more_link() {
    	return 'This is just a test';
    }
    add_filter( 'the_content_more_link', 'modify_read_more_link' );

    All I have is this in my child theme functions.php file and it is replacing the text when using the more tag for the content. However, maybe you are referring to some other type of more text?

    Thread Starter morshyo

    (@morshyo)

    I am not sure what it is called in English on WordPress, but when you create a post it shows on the front page, but if the text is too long I can press read more and it takes me to the full post. I want to change this button. Have I been changing some other button?
    That code doesn’t seem to work too.

    Hmm, maybe you’re referring to the excerpt? There is the excerpt_more hook you could try using

    https://developer.www.ads-software.com/reference/hooks/excerpt_more/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Twenty Twenty edit “Read more” text’ is closed to new replies.