WordPress.org

Ready to get started?Download WordPress

Forums

Boilerplate
[resolved] excerpts with different lengths? (3 posts)

  1. jynk
    Member
    Posted 9 months ago #

    I've used boilerplate_excerpt_length to change the default length. How can i create and excerpt with an alternative length for different pages?

  2. Thimothe
    Member
    Posted 9 months ago #

    This article might be useful for what you're looking for: Multiple excerpt lengths.

    The code will vary depending on what you are trying to achieve.

  3. Aaron T. Grogg
    Member
    Theme Author

    Posted 9 months ago #

    That function, which can be found starting line 259 of the function.php file, has a built-in default of 40, but you can pass any length in that you want:

    function boilerplate_excerpt_length( $length ) {
    	return 40;
    }

    So, you can use any method of determining which page you are on in your post/page templates, then simply pass that length value to the boilerplate_excerpt_length function.

    Hope this helps,
    Atg

Reply

You must log in to post.

About this Theme

About this Topic

Tags