You must be wondering when Thesis Theme offers great features, why there is no feature to adjust excerpt length on homepage ? Same question knocks my mind too, but I couldn’t find a good reason to it. Instead, I found an alternative to adjust teaser post length and in this article we will learn how to change excerpt length of teaser in thesis theme.
But before we go ahead with the tutorial, I recommend you to update Thesis Theme. Don’t know how to do that ? Well, it is simple, just refer to article Safely upgrade to latest version Thesis 1.8 ? If you don’t have Thesis Theme Copy then you can also Download Thesis Theme.
Analogy behind Excerpt Length of Teaser
One thing I like about customizing WordPress, is its filter feature, with which you can override any default function of WordPress. So, analogy behind adjusting excerpt length is too using WordPress filter and overriding it with another filter with new parameters.
Change Excerpt Length in Thesis Theme
To change excerpt length on homepage, add the below code in custom_functions.php in Thesis Theme.
NOTE: Make sure you take full backup of custom_functions.php file using FTP before modifying it or you can also refer to the article about how to safely edit custom_functions.php
// Teaser Length function teaser_length($length) { return 70; } add_filter('excerpt_length', 'teaser_length');
Once you have added above code in custom functions, refresh the website homepage and look for the teaser length. If it doesn’t satisfy you, simply adjust value on line number 3 of above code depending on your need.
With this we come to end of this simple tutorial where we learned how to adjust excerpt length in Thesis Theme. If you have any query or further assistance is required, post your feedback as comment below.
Great tutorial. Simple but very useful.
Thanks for this info guys. I tried it and there was no code crash or problems with admin or anything but the posts simply do not change to excerpt form. Any ideas what I am doing wrong?
The above code filter is applied to excerpt_length function only. If you have turned on the Featured Teasers from the Thesis Design Options, then it will not work. Reason behind this is that Featured Teaser doesn’t use Excerpt Function, but the Content Function.
Reference: http://www.thecreatology.com/ease-with-thesis-wordpress-theme-design-options-panel.html
Unfortunately you’re confusing post excerpt length with teaser length. The way your code reads you adjust everything – home page post excerpt along with any teasers present on the page. What most people are looking for is a way to lengthen the feature post without affecting the length of the teasers.
Crashed my site, not good.
I wonder how can a simple 4 line code, crashed your website. What was the error by the way ?
what does 70 Means in the line 3? does it characters or words?