Thread Starter
elrafo
(@elrafo)
OK I think this is the line that fetches the posts…is there a way to add something to display them in a reverse order?
while( $flexible_posts->have_posts() ) : $flexible_posts->the_post(); global $post; ?>
thanks
Plugin Author
DaveE
(@dpe415)
Hi elrafo,
I haven’t been ignoring your thread. In fact, I’ve thought a lot about how this might be possible. As it stands, I’m pretty confident that you’d need to reverse sort the array of results manually with PHP. I can’t think of a way that WordPress would allow you to reverse the order of the results after it has been queried. Essentially you’re querying for 3 posts ordered by newest and then you want to reorder your results from oldest to newest.
This wouldn’t be a FPW as much as an issue with how WordPress generates it’s own queries. Since this is beyond the scope of FPW, I can’t really provide you with an easy solution here.
I’m sorry I’m not more help on this one.
Thread Starter
elrafo
(@elrafo)
OK thanks anyway.
Just one thing, in the code above, $flexible_posts is an array that contains the posts I need (with the settings I specified in the widget)? Is it enough just to re-order this array before the while function?
thanks again.
elrafo
Plugin Author
DaveE
(@dpe415)
The reference to $flexible_posts
there is a PHP object containing the WordPress query details as well as the results. There is one property in the object called posts
which contains the complete set of posts returned by the query. I’d suggest reading over the WP_Query documentation as that is how all result sets are generated in WordPress, including the ones used by FPW.
Thread Starter
elrafo
(@elrafo)
Ok, I found a solution and wanted to post it, maybe someone will need it one day.
So I just added the line:
$flexible_posts->posts = array_reverse($flexible_posts->posts);
that line reverts the order of all the posts.
I just add it in a custom view under this condition if( $flexible_posts->have_posts() ):
Anyway, thanks a lot DaveE for your support, and merry xmas and happy holidays…
ps: Oh, nearly forgot, I found the solution on this post: http://css-tricks.com/forums/topic/how-to-display-wordpress-loop-pages-in-reverse-order-not-with-orderasc/