Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/06/2010, 12:19
codig0
 
Fecha de Ingreso: septiembre-2008
Ubicación: Lanzarote, Canarias
Mensajes: 486
Antigüedad: 15 años, 8 meses
Puntos: 41
Respuesta: Indexar notícias en mí Web

Añade esta función, en el functions.php de el template:

Código:
function Recortar($texto,$len){
$chars=strlen($texto);
if($chars>$len) $texto=substr($texto,0,$len-3)."...";
return $texto;
}
Luego en ves de:

Código:
<h4>Últimos posts</h4>
        <?php
       //Incluimos los archivos de wordpress
        define('WP_USE_THEMES', false);
        require('wordpress/wp-blog-header.php');
//Mostramos en random 5 post
        query_posts('showposts=5'); ?>
        <ul style="list-style: none;">
            <?php
            while (have_posts()): the_post();
            echo "<li><a href='".get_permalink($post->ID)."'>";
 the_title(); 
echo '</a></li>';
 
            endwhile; ?>
 
        </ul>
Pon:

Código:
<h4>Últimos posts</h4>
        <?php
       //Incluimos los archivos de wordpress
        define('WP_USE_THEMES', false);
        require('wordpress/wp-blog-header.php');
//Mostramos en random 5 post
        query_posts('showposts=5'); ?>
        <ul style="list-style: none;">
            <?php
            while (have_posts()): the_post();
            echo "<li><a href='".get_permalink($post->ID)."'>";
 the_title(); 
echo '</a> '.Recortar(get_the_content(),30).'</li>';
 
            endwhile; ?>
 
        </ul>
30 es el número de caracteres a mostrar...

Si te da error de la función Recortar, ponla en el mismo archivo.