| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * Template Name: WP Query Test |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | get_header(); |
|---|
| 7 | |
|---|
| 8 | // code for testing wp_reset_query() |
|---|
| 9 | |
|---|
| 10 | global $wp_query; |
|---|
| 11 | |
|---|
| 12 | // re-assign $wp_query |
|---|
| 13 | $wp_query = new WP_Query( array( 'post_type' => 'post' ) ); |
|---|
| 14 | // attempt to reset to $wp_the_query |
|---|
| 15 | wp_reset_query(); |
|---|
| 16 | |
|---|
| 17 | ?> |
|---|
| 18 | |
|---|
| 19 | <div id="primary" class="site-content"> |
|---|
| 20 | <div id="content" role="main"> |
|---|
| 21 | |
|---|
| 22 | <?php while ( have_posts() ) : the_post(); ?> |
|---|
| 23 | <?php get_template_part( 'content', 'page' ); ?> |
|---|
| 24 | <?php comments_template( '', true ); ?> |
|---|
| 25 | <?php endwhile; // end of the loop. ?> |
|---|
| 26 | |
|---|
| 27 | </div><!-- #content --> |
|---|
| 28 | </div><!-- #primary --> |
|---|
| 29 | |
|---|
| 30 | <?php get_footer(); ?> |
|---|