- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
WordPress Cherry 3.x. How to change excerpt length limit
September 22, 2014
Our Support team is ready to present you a new tutorial that will show you how to change excerpt length limit in WordPress templates.
WordPress. How to change excerpt length limit
Excerpts can be displayed with shortcodes, widgets, you can see the excerpts on your Blog page.
Excerpt length can usually be changed in the corresponding shortcode, widget settings or page template php file.
In case you need to set big value for the excerpt length, you will need to change the excerpt length limit, which is 60 words by default.
In order to change the excerpt length limit, please do the following:
-
Navigate to “wp-content/themes/CherryFramework” folder on your FTP. Open functions.php file.
-
Locate the function for the excerpt length, the code will look like the following:
/* * Custom excpert length * */ if(!function_exists('new_excerpt_length')) { function new_excerpt_length($length) { return 60; } add_filter('excerpt_length', 'new_excerpt_length'); }
Please don’t edit this file or any other files inside “CherryFramework” folder.
-
Copy the function body to themeXXXXX/includes/custom-function.php file. The code you need to copy:
function new_excerpt_length($length) { return 60; } add_filter('excerpt_length', 'new_excerpt_length');
-
Change the excerpt limit in this file now and save changes.
You can set any value less than the new excerpt length limit for the excerpt length.
Feel free to check the detailed video tutorial below: