Support » Plugin: Posts 2 Posts » [Plugin: Posts 2 Posts] Relationship meta order by

  • Resolved aaron@rossano.com.au

    (@aaronrossanocomau)


    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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’ );

    that worked. thank you funkatronic!.
    am i able to also combine the featured condition with the date of the posts as secondary order condition?

    Plugin Author scribu

    (@scribu)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Posts 2 Posts] Relationship meta order by’ is closed to new replies.