Very short trick: Wordpress, reset query
Wednesday, September 9, 2009 To me it happens very often to customize the Home Page index.php or other sections such as the Sidebar, a Web site built with Wordpress. Many of the customizations concern loop with specific parameters in order to see for example the last items of a specific category or tag. This operation, the place almost always using the query_posts() When you run a query_posts() are also affected some global variables, and often annoying when you have behavior - once - using features such as is_category() or is_page() From Release 2.3.0 of WordPress is available a convenient feature that is precisely the task of resetting the state altered by query_posts() wp_reset_query()
You just call the office at the end of our custom loop, so as to leave no trace in the system and so influence other functions that refer to global variables used by query_posts()
- / / Example in a hypothetical index.php
- / / To bottom, after performing one or more
- / / Query_posts () Personal
- ; get_sidebar ( ) ; get_footer ( ) ; ?> <? php wp_reset_query (); get_sidebar (); get_footer ();?>














I was really very auito your post.
thanks