• Hello!

    I have a 3×3 grid of squares, each containing a different category and I want each square to have a thumbnail and latest post excerpt. Currently I am doing it this way:

    <div class="left-content"><div class="aehead">ARTS & ENTERTAINMENT</div>
        <?php query_posts('posts_per_page=1&category_name=arts-entertainment'); if (have_posts()) : while (have_posts()) : the_post(); ?>
          <?php the_post_thumbnail('small-feature'); ?>
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            <?php the_excerpt(); ?>
        <?php endwhile; else : endif; ?>
      </div>

    You can see my example at http://nwq.benpotter.org/

    I would do this for each square changing &cat= to whatever the category is. It seems to work… more or less.

    However, after reading more about query_posts() i have come to think that perhaps I am doing this wrong and I need to call query_posts() ONCE, pull all the categories and then put them in their respective squares. Wrong or right? Any examples? Help please!

    Thank you

  • The topic ‘using query_posts, index.php and multiple categories’ is closed to new replies.