[closed] Excerpt length (4 posts)

  1. tmpage
    Posted 5 years ago #

    I am trying to change the maximum length of the post excerpts displayed on a category page (see http://www.obamatheconservative.com/category/latest-updates). I am using TwentyTen as a parent theme.

    I've tried two things, but had no luck with either:

    1) adding the following to functions.php:

    function new_excerpt_length($length) {
    	return 100;
    add_filter('excerpt_length', 'new_excerpt_length');

    So length should be max 100 words. But I still only got 40 words

    2) Editing the wp_trim_excerpt() function in formatting.php

    interestingly, it was already set to 55 -- but the post excerpts hadn't displayed more than 40 words, which suggests that the excerpt is not being produced via wp_trim_excerpt()

    Any suggestions? thanks!

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    From Twenty Ten functions.php:

    * function my_child_theme_setup() {
    * // We are providing our own filter for excerpt_length (or using the unfiltered value)
    * remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );

  3. tmpage
    Posted 5 years ago #

    thanks esmi,

    tried adding that to functions.php, but no luck.

    btw technically, i'm not using a child theme, I'm just editing the original TwentyTen files (though I know this is not recommended)

    any other thoughts? thanks!

  4. carlynorama
    Posted 4 years ago #

    I'm having the same trouble.

    Twenty Eleven Theme, WordPress 3.2.1, adding

    remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
    function new_excerpt_length($length) {
    	return 10;
    add_filter('excerpt_length', 'new_excerpt_length');

    to functions.php gives me no love when I use the_excerpt()

    Did this get resolved?

    [duplicate: http://wordpress.org/support/topic/custom-excerpt-length-doesnt-work-anymore?replies=4 - please ask your question in one topic only - closed]

Topic Closed

This topic has been closed to new replies.

About this Topic