aaron@rossano.com.au
Member
Posted 7 months ago #
I'm trying to order my relationship results with a meta value I've set in my relationship called featured. I've looked around the forum and couldn't find the answer.
I'd also like to be able to order it by date as well, is that possible to add in a second condition or meta?
sample code:
p2p_type( 'obj_to_obj2' )->each_connected( $my_query, array('orderby'=>'featured', 'order'=>'DESC','connected_order_num' => true), 'obj' );
http://wordpress.org/extend/plugins/posts-to-posts/
Manny Fleurmond
Member
Posted 7 months ago #
Is it a regular meta or a connection meta. If it's the later, then:
p2p_type( 'obj_to_obj2' )->each_connected( $my_query, array('connected_orderby'=>'featured', 'connected_order'=>'desc','connected_order_num' => true), 'obj' );
aaron@rossano.com.au
Member
Posted 7 months ago #
that worked. thank you funkatronic!.
am i able to also combine the featured condition with the date of the posts as secondary order condition?
In the development version (1.4.3-alpha), the field specified via 'orderby' is added to the ORDER BY clause in the query, after the 'connected_orderby' field.