Use wp_reset_query() for create independend multiple loop in a single page - WordPress

The function wp_reset_query() will unset $GLOBALS['wp_query'].

if using two or more costume query post in a particular section the first the query seems to stay active for the second loop. so to avoid this conflict use wp_reset_query() at the end of first loop.
Example :

<?php query_posts('p=169'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $linkto = get_post_custom_values("linkto"); ?>
<a href="#"><?php echo get_the_content(); ?></a>
<?php endwhile; endif; ?>
<?php wp_reset_query();?>

Comments

Popular posts from this blog

How To Install XAMPP in Support with PostgreSQL And phpPgAdmin

Smarty installation steps on WAMP and XAMPP

Mostly used web hosting control panels list