Limiting characters in excerpt? (1 post)

  1. yourbusybee
    Posted 2 years ago #

    Hi there,
    The theme developer doesn't seem interested in assisting with making changes to core files. Perhaps this is something I can set fairly easily though?

    I found this link and added the following to my functions.php file for the theme:

    function get_excerpt(){
    $excerpt = get_the_content();
    $excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
    $excerpt = strip_shortcodes($excerpt);
    $excerpt = strip_tags($excerpt);
    $excerpt = substr($excerpt, 0, 40);
    $excerpt = substr($excerpt, 0, strripos($excerpt, " "));
    $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));
    $excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>';
    return $excerpt;

    But I'm coming up empty on figuring out where to enter

    <?php echo get_excerpt(); ?>

    Thing is, there's a shortcode that came with the theme that allows you to include a blog listing by category within a post or a page. This is what I'd like to use this excerpt limiter.

    If it helps, the theme I'm using is called Churchope and is by Themeholics, and this is my dev page. I'm trying to use this on the homepage, to the right of the slideshow, below the menu (it's called Latest Posts). Currently it shows quite a bit of the post it's referencing. I want it to only show a few words, then a "more..." button.


    Thanks in advance.


Topic Closed

This topic has been closed to new replies.

About this Topic