• Hi, I want to have 2 loops on my index page. The first one has to show 4 post form a certain category, and the second one 10 post from another category.
    I’ve tried with query_post and $my_query, but they don’t seems to work. This is how my code looks like:

    <?php query_posts('category_name=appuntamenti&showpost=4'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="headlines">
    <?php the_time('d/m/Y') ?>
    &nbsp;<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?>
    </a></div>
    </div>
    <?php endwhile;?>
    <!-- loop 2-->
    <div class="loop"><img src="https://demon.wererabbit.net/wp-content/themes/demon/images/notiziepubbliche.gif"></div>
    <?php query_posts('category_name=notizie&showpost=10'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?>
    </a></h1>
    <?php the_time('F jS, Y') ?>
    <!-- by <?php the_author() ?> -->
    <div class="entrytext">
    <?php the_excerpt('Read the rest of this entry &raquo;'); ?>
    </div>
    </div>
    <?php endwhile; ?>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘multiple loops’ is closed to new replies.