[theme-reviewers] Feedback on use of query_posts please - Bad idea?

Edward Caissie edward.caissie at gmail.com
Sat Sep 14 00:57:26 UTC 2013


Using `WP_Query` is always going to be much better ...

... here's another example, although from one of my plugins, it is used to
create a complete loop for the plugin's output:

https://github.com/Cais/bns-featured-category/blob/master/bns-featured-category.php#L249

That is the actual call to `WP_Query` you can see above where its arguments
are generated and below where it is used.

Edward Caissie
aka Cais.


On Fri, Sep 13, 2013 at 8:51 PM, Zulfikar Nore <zulfikarnore at live.com>wrote:

> Sound advice there, cheers :)
>
> And that link sets me off in the right direction, thanks for the share.
>
> ------------------------------
> From: philip at frumph.net
> To: theme-reviewers at lists.wordpress.org
> Date: Fri, 13 Sep 2013 17:38:49 -0700
> Subject: Re: [theme-reviewers] Feedback on use of query_posts please - Bad
> idea?
>
>
>  You probably should be using new $wp_query
>
> mines not the best but here’s my blog.php
>
> https://github.com/Frumph/comicpress/blob/master/blog.php
>
>
>
>  *From:* Zulfikar Nore <zulfikarnore at live.com>
> *Sent:* Friday, September 13, 2013 5:22 PM
> *To:* Theme Reviewers <theme-reviewers at lists.wordpress.org>
> *Subject:* [theme-reviewers] Feedback on use of query_posts please - Bad
> idea?
>
>  I've read around that using query_posts is bad but I've seen many a
> themes using it and get away with it.
>
> My case is I'm trying to put together a template-blog.php for StrapVert
> and this is what I've come up with so far:
>
>  add_filter('option_show_on_front', '__return_false');
>   global $wp_query;
>     query_posts(array(
>   'paged' => $wp_query->get('paged'),
>   'post__not_in' => get_option('sticky_posts'),
>     ));
>
>   global $more; $more = 0;
>     get_template_part('index-blog');
>        $more = 1;
> remove_filter('option_show_on_front', '__return_false');
>
>    wp_reset_query();
> wp_reset_postdata();
>
> But before I add these changes to the theme and submit an update I'd like
> some feedback on "How Really Bad" is query_posts and can I "get away" with
> the above?
>
> Thanks in advance,
> Zulf
>
> ------------------------------
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
> _______________________________________________ theme-reviewers mailing
> list theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130913/938a4ed1/attachment-0001.html>


More information about the theme-reviewers mailing list