[theme-reviewers] Proper use of pre_get_posts callback

priyanshu mittal priyanshu.mittal at gmail.com
Thu Oct 2 19:09:27 UTC 2014


There you go https://themes.trac.wordpress.org/ticket/20284

On Thu, Oct 2, 2014 at 2:49 AM, Konstantin Kovshenin <kovshenin at gmail.com>
wrote:

> In that case new WP_Query() is just as "incorrect" as query_posts().
> Both are used for secondary loops, the former is just a bit more sane
> than the latter, but under the hood they're pretty much the exact same
> thing.
>
> If the developer needs to alter the main loop, they should be using
> the pre_get_posts action, not overwriting the query with something
> else. It would also help if you provided a link to the ticket.
>
> On Tue, Sep 30, 2014 at 12:12 PM, priyanshu mittal
> <priyanshu.mittal at gmail.com> wrote:
> > I am reviewing a theme.
> >
> > In this theme developer used a slider and masonary layout from the
> index.php
> > file.
> >
> > He used sticky posts to make up the slider:- for this the seperate
> wp_query
> > object is called and properly resetted via wp_reset_postdata function.
> >
> > In the masonry layout of posts in order to use his own custom pagination
> > function, he used query_posts, to alter the core loop, I know this is not
> > the correct way to do it.
> >
> > My point is should I ask him to create new wp_query object for this or
> > should I advice him to use pre_get_posts function.
> >
> > Thanks
> >
> > _______________________________________________
> > theme-reviewers mailing list
> > theme-reviewers at lists.wordpress.org
> > http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> >
>
>
>
> --
> Konstantin
> _______________________________________________
> 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/20141003/f9fe5725/attachment.html>


More information about the theme-reviewers mailing list