• I have the following code to control the amount of characters in my excerpt to show on a page:

    function get_my_excerpt(){
    $excerpt = get_the_content();
    $excerpt = substr($excerpt, 0, 200);
    $excerpt = strip_shortcodes($excerpt);
    $excerpt = substr($excerpt, 0, strripos($excerpt, " "));
    $excerpt = strip_tags($excerpt);
    $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
    $excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
    $excerpt = $excerpt.'... [Read More]';
    return $excerpt;
    }

    I can’t for the life of me remember how to code this part:
    $excerpt = $excerpt.’… [Read More]’;

    so that the [Read More] links to the post for further reading associated to the post it’s for.

    Can someone help?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Excerpt Function’ is closed to new replies.