Revision: 42817
Updated Code
at March 11, 2011 02:26 by johnsardine
Updated Code
//Excerpt - usage - < ?php echo excerpt(15); ? > - remove the spaces between the < and ? function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return $excerpt; }
Revision: 42816
Updated Code
at March 11, 2011 02:25 by johnsardine
Updated Code
//Excerpt - usage - <?php echo excerpt(15);? > function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return $excerpt; }
Revision: 42815
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 11, 2011 02:23 by johnsardine
Initial Code
//Excerpt - usage - < ? php echo excerpt(15); ? > function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return $excerpt; }
Initial URL
http://johnsardine.com
Initial Description
I did not created this, a friend provided it to me, and it seems really usefull so i thought i should share. Usage: Paste that code in your functions .php and in your theme you put <?php> where 20 is the number of words you want
Initial Title
Wordpress - Custom Except Anywhere
Initial Tags
wordpress
Initial Language
PHP