Support » Installing WordPress » How to add custom text between content and more link in the_content

  • I tried to do this but ” my custom text” appears after the more link

    function wp_new_content($content) {
    return $content.” my custom text”;
    add_filter(‘the_content’, ‘wp_new_content’);

    I thought I could do it the same as the excerpt function below using get_the_content but instead replacing $text for $content and not checking for empty string but that doesn’t work. So was trying to using the_content instead.

    [code moderated – please follow the forum guidelines]

Viewing 6 replies - 1 through 6 (of 6 total)
  • If you would like your text to display after the content you will want to use the add_action functions instead of add_filter. e.g.

    function wp_new_content() {
    echo “my custom text”;
    add_action(‘the_content’, ‘wp_new_content’);

    Give that a try.

    I just realized the example I gave you will replace all the text. Try this instead.

    function wp_new_content($content) {
    echo $content.”my custom text”;
    add_action(‘the_content’, ‘wp_new_content’);

    Thanks for the reply Mat, I tried the above but it still comes out after the more link I copied and pasted the page text below.

    “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent viverra lorem ut leo bibendum mattis egestas quam mollis. Donec at lacus sem. Sed fermentum cursus tellus sit amet bibendum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Phasellus ultrices ipsum sed quam viverra sit amet ornare metus ornare. Integer eu erat sit amet justo tristique ultrices. Morbi tristique, nisl ut dignissim congue, est velit blandit tellus, at rhoncus felis velit iaculis nisi.

    Continue reading

    my custom text”

    I had to put my thinking cap on to remember how to do this, but I think I figured it out… See Below

    `add_filter( ‘excerpt_more’, ‘child_read_more_link’ );
    add_filter( ‘get_the_content_more_link’, ‘child_read_more_link’ );
    add_filter( ‘the_content_more_link’, ‘child_read_more_link’ );
    * Custom Read More link.
    function child_read_more_link() {

    return ‘my custom Text <a href=”‘ . get_permalink() . ‘” rel=”nofollow”>Continue Reading …</a>’;


    Hi Mat, thanks for the help that works great!!! I really appreciate the help 🙂


Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add custom text between content and more link in the_content’ is closed to new replies.