[wp-hackers] WP_Query and orderby - outside of WP
SWORD Studios
info at swordstudios.net
Mon May 14 16:09:47 UTC 2012
I don't see an orderyby just an order. You have to define that you want to
orderby title or date or whatever
'orderby' => 'title', 'order' => 'DESC'
On Mon, May 14, 2012 at 11:55 AM, Bill Dennen <dennen at gmail.com> wrote:
> Hi,
>
> I have a regular PHP script that bootstraps WordPress by including
> wp-load.php (as previously discussed on this list).
>
> I'm doing something relatively simply --
>
> a) loading WP
> b) grabbing posts of a certain custom post type
>
> I'd like to change the orderby, but no matter what I pick for orderby,
> the posts come back in the same order (ie. date).
>
> Here's my code:
>
> --
>
> global $wp_the_query, $wp_query, $wp_rewrite, $wp;
> define('DISABLE_WP_CRON', true);
> require_once('/home/wheaton/public_html/wp-load.php');
> $quilts = new
> WP_Query('post_type=profiles&post_status=publish&orderby=rand' );
> while ( $quilts->have_posts() ) : $quilts->the_post();
> // etc
>
> --
>
> In short, changing the orderby parameter has no effect. ie. title, rand,
> etc.
>
> What could be causing this? Might it have to do with bootstrapping WP
> in this way?
>
> Doc: http://codex.wordpress.org/Class_Reference/WP_Query
>
> Thanks-
> Bill
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
thanks,
*Jesse Friedman | *Web Nerd
508-507-9673 | jesserfriedman at gmail.com
http://jesserfriedman.com | http://braintoblog.com | @professor<
http://twitter.com/professor>
More information about the wp-hackers
mailing list