WordPress.org

Support

Support » Themes and Templates » Excerpt length

Excerpt length

  • 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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    @esmi

    Forum Moderator

    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’ );

    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!

    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]

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