query_posts causing page load delay – Best alternative?
-
I’m currently using query_posts to select posts with a specific tag to display. I have to do this a total of 6 times on one page, with a different tag being pulled each time.
I know there’s got to be a better way to do this… I’m getting some page load delays from the code below. Any help is greatly appreciated!
<?php query_posts('tag=home_1&category=1&posts_per_page=1'); ?> <?php while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'home-thumbnails' ); ?> <header class="article-header"> <h1><?php the_title(); ?><img src="/wp-content/themes/az***/library/images/arrows.png" class="arrow" alt="Post Arrows" title="post arrows" /></a></h1> </header><!-- end article header --> </article><!-- end article --> <?php endwhile; ?> <?php rewind_posts; ?> <?php query_posts('tag=home_2&category=1&posts_per_page=1'); ?> <?php while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'home-thumbnails' ); ?> <header class="article-header"> <h1><?php the_title(); ?><img src="/wp-content/themes/az***/library/images/arrows.png" class="arrow" alt="Post Arrows" title="post arrows" /></a></h1> </header><!-- end article header --> </article><!-- end article --> <?php endwhile; ?> <?php rewind_posts; ?> <?php query_posts('tag=home_3&category=1&posts_per_page=1'); ?> <?php while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'home-thumbnails' ); ?> <header class="article-header"> <h1><?php the_title(); ?><img src="/wp-content/themes/az***/library/images/arrows.png" class="arrow" alt="Post Arrows" title="post arrows" /></a></h1> </header><!-- end article header --> </article><!-- end article --> <?php endwhile; ?> <?php rewind_posts; ?> <?php query_posts('tag=home_4&category=1&posts_per_page=1'); ?> <?php while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'home-thumbnails' ); ?> <header class="article-header"> <h1><?php the_title(); ?><img src="/wp-content/themes/az***/library/images/arrows.png" class="arrow" alt="Post Arrows" title="post arrows" /></a></h1> </header><!-- end article header --> </article><!-- end article --> <?php endwhile; ?> <?php rewind_posts; ?> <?php query_posts('tag=home_5&category=1&posts_per_page=1'); ?> <?php while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'home-thumbnails' ); ?> <header class="article-header"> <h1><?php the_title(); ?><img src="/wp-content/themes/az***/library/images/arrows.png" class="arrow" alt="Post Arrows" title="post arrows" /></a></h1> </header><!-- end article header --> </article><!-- end article --> <?php endwhile; ?> <?php rewind_posts; ?> <?php query_posts('tag=home_6&category=1&posts_per_page=1'); ?> <?php while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'home-thumbnails' ); ?> <header class="article-header"> <h1><?php the_title(); ?><img src="/wp-content/themes/az***/library/images/arrows.png" class="arrow" alt="Post Arrows" title="post arrows" /></a></h1> </header><!-- end article header --> </article><!-- end article --> <?php endwhile; ?> <?php rewind_posts; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘query_posts causing page load delay – Best alternative?’ is closed to new replies.