• I just can’t seem to get this line right. I think I am awfully close. My code editor tells me I have a syntax error.
    return <a 'href="'. get_permalink($post->ID) . '">' . 'Continue Reading:'. get_the_title() . '</a>'); 

    Just in case here is the whole function. It works fine without my attempt to add the post title after Continue Reading.

    function new_excerpt_more($more) {
           global $post;
        return <a 'href="'. get_permalink($post->ID) . '">' . 'Continue Reading:'. get_the_title($post->ID) . '</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more'); 

Viewing 2 replies - 1 through 2 (of 2 total)
  • You had a ‘ in the wrong place.

    function new_excerpt_more($more) {
           global $post;
        return '<a href="'. get_permalink($post->ID) . '">' . 'Continue Reading:'. get_the_title($post->ID) . '</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    Thread Starter mgason

    (@mgason)

    Thanks so much. I figured I had one wrong and I tried changing them around, obviously I am no PHP expert. It was the first ‘ which I did not change because it was from the example I copied not what I was adding. The code I copied was wrong, not my addition :-0

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php syntax slightly wrong. adding read more with title to auto excerpt’ is closed to new replies.