Codex

Riferimento funzioni/wp reset query

Contents

Descrizione

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.

Utilizzo

<?php wp_reset_query(); ?>

Parametri

Questa funzione non accetta alcun parametro.

Valori di ritorno

Questa funzione non restituisce alcun valore.

Esempi

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();
?>

Change Log

File sorgente

wp_reset_query() si trova in wp-includes/query.php.

Correlati

Query Tags: WP_Query (Classe), get_query_var(), query_posts(), have posts(), the_post(), rewind_posts(), wp_reset_postdata(), wp_reset_query()

See also index of Function Reference and index of Template Tags.