Codex tools: Log in
Languages: English • Italiano • (Add your language)
Contents |
Questa funzione distrugge la query precedente utilizzata in un ciclo (Loop) personalizzato. La funzione dovrebbe venir richiamata dopo il The Loop per assicuarsi che i tag condizionali operino come ci si aspetta.
<?php wp_reset_query(); ?>
Questa funzione non accetta alcun parametro.
Questa funzione non restituisce alcun valore.
L'esempio seguente mostra come utilizzare wp_reset_query() dopo un ciclo personalizzato
<?php query_posts( 'posts_per_page=5' ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?><a href="<?php the_permalink() ?>"><?php the_title() ?></a><br /><?php endwhile; endif; wp_reset_query(); ?>
wp_reset_query() si trova in wp-includes/query.php.
Query Tags: WP_Query (Classe), get_query_var(), query_posts(), have posts(), the_post(), rewind_posts(), wp_reset_postdata(), wp_reset_query()