Forums

function new_excerpt_length not working in 3.1 (5 posts)

  1. denzel2364
    Member
    Posted 1 year ago #

    The function excerpt_length doesnt work in WordPress 3.1. I have added this code below to functions.php but no luck

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

    Any ideas?

  2. denzel2364
    Member
    Posted 1 year ago #

    no ideas?

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    which theme are you using? for instance the twentyten uses this to set excerpt length already....

    function twentyten_excerpt_length( $length ) {
    	return 40;
    }
    add_filter( 'excerpt_length', 'twentyten_excerpt_length' );

    just making sure you don't have some sort of conflict

  4. RobotElettronici
    Member
    Posted 1 year ago #

    Same problem here on a custom theme.
    Looks like twentyten has defined the function but never calls it anywhere.

  5. RobotElettronici
    Member
    Posted 1 year ago #

    Nevermind, just call the function
    <?php the_excerpt();?>
    and it will works using the new filter.

Topic Closed

This topic has been closed to new replies.

About this Topic