Come creare un tema per wordpress 3.0 – Tips 2

Con questo trucco mostreremo solo una parte del contenuto, senza immagini.

Nell’index.php aggiungiamo al post del the_content

<?php the_excerpt(); ?>

in functions.php:

<!–Link della excerpt–>
<?php
function new_excerpt_more($more) {
global $post;
return ‘…&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=”‘. get_permalink($post->ID) . ‘”>’ . ‘Continua a leggere’ . ‘</a>’;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);

?>

<!–prendo 100 parole invece delle 55 di default–>
<?php function new_excerpt_length($length) {
return 100;
}
add_filter(‘excerpt_length’, ‘new_excerpt_length’);
?>

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *

*


È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">