Forums

One loop vs multiple loops on static homepage? (1 post)

  1. Jacorre
    Member
    Posted 1 year ago #

    Hello,

    I have a static homepage using multiple loops to display each category with 3 random post entries. I'm using something like the following:

    <ul>
    <?php query_posts('cat=6&orderby=rand&showposts=3'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <li><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><img src="<?php echo get_post_meta($post->ID,'thumbnail', true); ?>" alt="<?php the_title(); ?>" /></a></li>
    <?php endwhile;?>
    </ul>

    But because I have 12 categories, I'm using 12 query post loops to generate the content. I was wondering if there was a more efficient way of doing it? Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic