WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have been doing some digging and narrowed down the file that I believe is calling for the front page excerpts on all posts. No matter what I change it to, it doesn't seem to adjust.

//get excerpt for feed panels
function con_feed_excerpt() {
$excerpt = get_the_excerpt();       
if (strlen($excerpt)>230) {
    $excerpt = substr($excerpt, 0, 227) . "...";
echo $excerpt;

This looks to be where it is getting the excerpt length from the first character to the 227th char and then ending with a ...

I've tried changing the 227 and re-uploading to my server and to no avail.

Any clues what might be preventing it?

share|improve this question

migrated from stackoverflow.com Apr 26 '12 at 0:43

This question came from our site for professional and enthusiast programmers.

Are you certain that's the right function because seems to be for the RSS feed or something to do with RSS/Feed. Which file is that in? Which file is controlling your front page? Is it an index.php file or is it another file being called into index.php or are you being redirected to another file from index.php. The likely culprit lay within that file whichever it may be. Need more info... – userabuser Apr 26 '12 at 0:57
Also: Please always provide a link – kaiser Apr 26 '12 at 1:30
Please, provide a link! And, there are some caches enabled in the site? – keatch May 3 '12 at 12:36

Here is a custom function I've written to modify your excerpt however you want. You should NOT be changing any core files to make modifications, as these will be overwritten by any updates made to the Wordpress framework:

remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'preserve_excerpt_format');
function preserve_excerpt_format($text)
    global $post;
    $raw_excerpt = $text;
    if ('' == $text )
        $text = get_the_content('');
        $text = strip_shortcodes($text);
        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]>', $text);

        $exceptions = '<p>,<a>,<em>,<strong>,<br>'; //PRESERVE THESE TAGS, ADD/REMOVE AS NEEDED
        $text = strip_tags($text, $exceptions);

        $excerpt_length = apply_filters('excerpt_length', $maxCount);

        $moreText = '.... <a class="blue" href="'.get_permalink($post->ID).'">Read More &gt;&gt;</a>'; //CUSTOM MORE TEXT, CHANGE AS NEEDED
        $excerpt_more = apply_filters('excerpt_more', $moreText);

        $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length+1, PREG_SPLIT_NO_EMPTY);
        if(count($words) > $excerpt_length)
            $text = implode(' ', $words);
            $text = $text.$excerpt_more;
            $text = implode(' ', $words);
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);

Place this in the functions.php file of your current theme, and change as needed.

share|improve this answer

I did seem to get it working with a custom plugin. There doesn't seem to be an option for adjusting the front of site feed versus the category feeds. I found out later that modifying the 227 figure to say 800 just lengthened the excerpt for the individual feed and not for the front page posts.

All is well with an excerpt plugin though, lets me set both which is exactly what I wanted.

share|improve this answer
which plugin did you use to solve this? I have the same problem here – user18615 Jul 27 '12 at 5:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.