0
Votre page index ressemble sûrement à ceci :
<!-- #content -->
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
<div class="entry">
<?php the_content(); ?>
</div>
<div class="categories">Publié dans <?php the_category(', ') ?></div>
</div>
<?php endwhile; ?>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
<?php else : ?>
<h2>Aucun article pour l'instant.</h2>
<?php endif; ?>
</div>
<!-- /#content -->
Si vous avez besoin d’ajouter une classe spécifique, par exemple « last », sur le dernier post, allez-y en jQuery pour éviter de créer un filtre (« add_filter ») dans WordPress :
$(document).ready(function() {
/* DERNIER POST DE LA LOOP
**************************************************************************/
$('#content .post').last().addClass('last');
});
Et hop !
DATE 05 Sep 2011

