WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven Excerpt Length (2 posts)

  1. BillEl777
    Member
    Posted 2 years ago #

    Just wondering if there would be anyway to pass a number, on a per template basis, to:

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

    Instead of it returning 40 for all excerpts it could return the passed variable that way having custom excerpts lengths in different templates etc...

  2. BillEl777
    Member
    Posted 2 years ago #

    Well what does seem to work is to take the above code out of the functions.php file and insert it into each page you want to use an excerpt.

    Change the 40 to whatever you want and viola!

Topic Closed

This topic has been closed to new replies.

About this Topic