Read More Tag — How to display a text link?

Viewing 5 posts - 1 through 5 (of 5 total)
  • #20991
    morykwas
    Participant

    Daniel Tara, I really would appreciate your help!
    Here’s our website…

    http://www.schoollifetroy.com

    We’re using a child theme of Pinboard, which is very popular with visitors. The only problem is that no text link appears after a Read More tag. I want it to say “Click here to read more” or something like that.

    Any suggestions?

    Ed Morykwas
    School Life Troy

    #20996
    Daniel Tara
    Keymaster

    Try adding this functions to functions.php:

    add_filter( 'the_excerpt', 'pinboard_excerpt_read_more' );
    
    function pinboard_excerpt_read_more( $excerpt ) {
        return str_replace( '</p>', ' <a href="' . get_permalink() . '" rel="bookmark">Read More &rarr;</a></p>', $excerpt );
    }
    #21000
    morykwas
    Participant

    Thank you, sir, for your help.
    Unfortunately those lines had no effect when I pasted them into functions.php.
    Is there something else I can do?

    function child_scripts_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css', array() );
    }
    add_action( 'wp_enqueue_scripts', 'child_scripts_styles' );
    add_filter( 'the_excerpt', 'pinboard_excerpt_read_more' );
     
    function pinboard_excerpt_read_more( $excerpt ) {
        return str_replace( '', ' <a href="' . get_permalink() . '" rel="bookmark">Read More &rarr;</a>', $excerpt );
    }
    #21002
    Daniel Tara
    Keymaster

    Sorry, I made a typo in the code above. Here is the correct code:

    add_filter( 'the_excerpt', 'pinboard_excerpt_read_more' );
    
    function pinboard_excerpt_read_more( $excerpt ) {
        return str_replace( '</p>', ' <a href="' . get_permalink() . '" rel="bookmark">Read More &rarr;</a></p>', $excerpt );
    }
    #21003
    morykwas
    Participant

    That is absolutely fantastic: a quick and easy solution that works perfectly! Thank you again for taking time to answer my question, Daniel. You can mark this one “Case Closed.”

    Best wishes from Troy, Michigan.
    –Ed

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.