title: Wordpress excerpt link: http://jj.isgeek.net/2005/12/wordpress-excerpt/ author: Jj description: post_id: 76 date: 2005/12/25 23:21:13 created_gmt: 2005/12/26 04:21:13 comment_status: open slug: wordpress-excerpt [Antonio](http://www.gnrfan.org) hizo un comentario diciendo que los posts no salian completos en mi feed. Eso era por que en la configuración de [Wordpress](http://www.wordpress.org/) indico que se muestre sólo una parte y no el post completo. El asunto es que al hacer esto Wordpress quitaba todas las imágenes, y formatos de el contenido del post. De ésta manera podÃa contar las palabras y mostrar únicamente las primeras 55, dejando texto sin formato y sin imágenes en el feed, que era de lo que se quejaba Antonio. Busqué si habÃa algun plugin que solucionara mi problema y que me permitiera tener resúmenes de post con formato, pero no encontré ninguno. Fuà al canal de `#wordpress` a preguntar pero tampoco me supieron dar razón :(. Terminé nadando en el código fuente de Wordpress siguiendo los archivos hasta llegar a la función que generaba el resumen, está en el archivo `wp-includes/functions-formatting.php` function wp_trim_excerpt( $text ) { // Fakes an excerpt if needed global $post; if ( '' == $text ) { $text = $post->post_content; $text = strip_tags( $text ); $blah = explode(' ', $text); $excerpt_length = 55; if (count($blah) > $excerpt_length) { $k = $excerpt_length; $use_dotdotdot = 1; } else { $k = count($blah); $use_dotdotdot = 0; } $excerpt = ''; for ($i=0; $i<$k; $i++) { $excerpt .= $blah[$i].' '; } $excerpt .= ($use_dotdotdot) ? '[...]' : ''; $text = $excerpt; $text = $excerpt; } // end if no excerpt return $text; } Lo que hice fué cambiar la función para que use como resumen el primer párrafo (
) cambiando la función: function wp_trim_excerpt( $text ) { // Fakes an excerpt if needed global $post; if ( '' == $text ) { $text = $post->post_content; //Only use the first paragraph $boob = explode('', $text); if(count($boob) <= 2) { //There was less than two s $excerpt = $text; } else { /* There was a , then the excerpt is the first line up to that */ $excerpt = $boob[0]."".$boob[1].""; } $text = $excerpt; } // end if no excerpt return $text; } Puedo poner el link para que "Continues" a el respectivo permalink. Cambiarla para que muestre mas de un párrafo es muy simple. Voy a probar como va con uno, sino le aumentaré :). **Update**: Cambié la función para que muestre dos párrafos y el _"Continuar..."_ tenga vÃnculo al post ## Comments **[casino craps gambling](#100 "2006-01-08 20:39:59"):** locked door kicked open The dust hadnt even cleared before Marty [casino craps gambling](http://casino-craps-gambling.amparks.net) Several hours later Marty was still talking about the evenings events . **[new online casino](#101 "2006-01-08 21:28:56"):** the radio off shaking his head in disgust [new online casino](http://new-online-casino.newsua.org) Mr Arky . **[pogo video poker](#108 "2006-01-12 05:35:07"):** Inside the artillery bunker Captain Teague began to pass out [pogo video poker](http://www.Casinos-OnWeb-Winner.info) being allowed inside This suburbian site was 15 miles from the blast . **[William Tobias](#171 "2006-01-29 06:30:35"):** jacket had caught on the door jamb He tried frantically to get it [onlkne casinos](http://www.Internet-Casinos-Bonuses.info) At the back of the class Biff and his group started to make farting . **[Reid Layton](#201 "2006-02-14 03:48:23"):** dad immediately turned away from the TV [casino slot machine](http://casino-slot-machine.0casinos.com/casino-slot-machine.html) it for the third time The engine groanedbut then it caught! He .