Skip to main content
Commonmark migration
Source Link

#query_posts = _your_doing_it_wrong

query_posts = _your_doing_it_wrong

as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work.

change:

 query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );
              if ( have_posts() ) : while ( have_posts() ) : the_post();

to:

   $my_query = new WP_Query( array( 'post_type' => 'fieldtrips',
                                    'fieldtripcategory' => 'elementary-school-aquifer',
                                     'order' => 'ASC',
                                     'posts_per_page' => 1
                          ));
                  if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();

Also remove the wp_reset_query.

#query_posts = _your_doing_it_wrong

as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work.

change:

 query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );
              if ( have_posts() ) : while ( have_posts() ) : the_post();

to:

   $my_query = new WP_Query( array( 'post_type' => 'fieldtrips',
                                    'fieldtripcategory' => 'elementary-school-aquifer',
                                     'order' => 'ASC',
                                     'posts_per_page' => 1
                          ));
                  if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();

Also remove the wp_reset_query.

query_posts = _your_doing_it_wrong

as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work.

change:

 query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );
              if ( have_posts() ) : while ( have_posts() ) : the_post();

to:

   $my_query = new WP_Query( array( 'post_type' => 'fieldtrips',
                                    'fieldtripcategory' => 'elementary-school-aquifer',
                                     'order' => 'ASC',
                                     'posts_per_page' => 1
                          ));
                  if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();

Also remove the wp_reset_query.

replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

#query_posts = _your_doing_it_wrong_your_doing_it_wrong

as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work.

change:

 query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );
              if ( have_posts() ) : while ( have_posts() ) : the_post();

to:

   $my_query = new WP_Query( array( 'post_type' => 'fieldtrips',
                                    'fieldtripcategory' => 'elementary-school-aquifer',
                                     'order' => 'ASC',
                                     'posts_per_page' => 1
                          ));
                  if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();

Also remove the wp_reset_query.

#query_posts = _your_doing_it_wrong

as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work.

change:

 query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );
              if ( have_posts() ) : while ( have_posts() ) : the_post();

to:

   $my_query = new WP_Query( array( 'post_type' => 'fieldtrips',
                                    'fieldtripcategory' => 'elementary-school-aquifer',
                                     'order' => 'ASC',
                                     'posts_per_page' => 1
                          ));
                  if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();

Also remove the wp_reset_query.

#query_posts = _your_doing_it_wrong

as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work.

change:

 query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );
              if ( have_posts() ) : while ( have_posts() ) : the_post();

to:

   $my_query = new WP_Query( array( 'post_type' => 'fieldtrips',
                                    'fieldtripcategory' => 'elementary-school-aquifer',
                                     'order' => 'ASC',
                                     'posts_per_page' => 1
                          ));
                  if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();

Also remove the wp_reset_query.

Source Link
Chris_O
  • 20.6k
  • 5
  • 61
  • 95

#query_posts = _your_doing_it_wrong

as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work.

change:

 query_posts( array( 'post_type' => 'fieldtrips', 'fieldtripcategory' => 'elementary-school-aquifer', 'order' => 'ASC', 'posts_per_page' => 1 ) );
              if ( have_posts() ) : while ( have_posts() ) : the_post();

to:

   $my_query = new WP_Query( array( 'post_type' => 'fieldtrips',
                                    'fieldtripcategory' => 'elementary-school-aquifer',
                                     'order' => 'ASC',
                                     'posts_per_page' => 1
                          ));
                  if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();

Also remove the wp_reset_query.