WordPress loops

Este post se publicó hace más de dos años, es posible que la información publicada esté obsoleta o las referencias no existan.

Loop básico para wordpress

<?php while (have_posts()) : the_post(); ?> 
    <h1>
        <a href="<?php the_permalink() ?>" rel="bookmark" title="Enlace a: <?php the_title(); ?>">
            <?php the_title(); ?>
        </a>
    </h1>
    <p><?php the_time('F jS, Y') ?></p>
    <p><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>    
    <?php the_excerpt(); ?>

<?php endwhile; ?>  
<?php next_posts_link('« Previous Entries') ?>
<?php previous_posts_link('Next Entries »') ?>

Loop Alternativo con WP_Query

<?php
    $args = array(
        'posts_per_page' => 3,
        'cat' => 8,
        'offset' => 1
    );
    $loop_alternativo = new WP_Query($args);
    if( $loop_alternativo->have_posts() ):
    while( $loop_alternativo->have_posts() ): $loop_alternativo->the_post();
        the_title();
    endwhile;
    endif;
    wp_reset_postdata();
?>