Support » Plugins » Optimize Multiple Loops

  • Hi there,

    I’m trying to optimize my blog homepage. it current has 9 loops on the front page. Each loop fetches 3 posts from a different category while one of them has an offset of 3 posts.

    This is what each loop looks like:

    <h2>Category 1</h2>
                       $myPosts = new WP_Query();
                       while ($myPosts->have_posts()) : $myPosts->the_post(); ?>
                        <h3><a href="<?php the_permalink(); ?>" target="<?php echo "$pref"; ?>"><?php the_title(); ?></a></h3>
                        <div class="post-meta"><?php the_time('l, jS F, Y'); ?> - <?php the_time() ?></div>
                       <?php the_content(); ?>
    					<div class="comments-source">
                       	<div class="csleft"><a href="<?php the_permalink(); ?>"><?php comments_number( 'Leave a Comment', '1 comment', '% comments' ); ?></a></div>
                        <div class="csright">Source: <?php the_author_posts_link(); ?></div>
                       <?php wp_reset_postdata ?>
                       <?php endwhile; ?>

    I’m using W3 Total Cache but my homepage changes every few minutes and takes about 30 seconds to rebuild. Is there a more efficient way of doing this?

    Thanks in advance.

  • The topic ‘Optimize Multiple Loops’ is closed to new replies.