Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*Add this block to functions.php */
- function my_excerpt_length() {
- global $myExcerptLength;
- if ($myExcerptLength) {
- return $myExcerptLength;
- } else {
- return 80; //default value
- }
- }
- add_filter('excerpt_length', 'my_excerpt_length');
- ?>
- <?php
- /*Add this in your theme where you want the excerpt to show*/
- $myExcerptLength=35;
- echo get_the_excerpt();
- $myExcerptLength=0;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement