new WP_Query vs. query_posts in Customizr loop
-
The question today is this with customizr:
If I modify the loop in a page template using new WP_Query
<?php $args = array( 'post_type' => 'projects', 'posts_per_page' => -1, 'cat' => 77 ); $query = new WP_Query( $args); ?> <?php if ( $query->have_posts() ) : ?> <?php while ( $query->have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?> <?php $query->the_post(); ?> <?php do_action ('__before_article') ?> <article <?php tc__f('__article_selectors') ?>> <?php do_action( '__loop' ); ?> </article> <?php do_action ('__after_article') ?> <?php endwhile; ?> <?php endif; ##end if have posts ?> <!-- Reset Query --> <?php wp_reset_query(); ?>
I get the list of what I want but no links to the title, entry metas and so on;
but if I use query_posts instead of new WP_Query…
<?php query_posts( 'post_type=projects&cat=77&posts_per_page=-1' ); ?> // the customizr loop
… the result is the same but with links and metas.
WP is pushing the use of new WP_Query instead of query_posts, but query_posts actually works better than new WP_Query in the customizr template.
Am I missing something here? Did I get it wrong?
Any tip on this please?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘new WP_Query vs. query_posts in Customizr loop’ is closed to new replies.