[Plugin: Posts 2 Posts] posts 2 posts – How to orderby by conneced posts
-
First, many thanks to Scribu – you rock!! What a great plugin is this.
I’m trying to order posts by date of all the connected posts, but can’t do it, I think I miss a parameter.
I have 2 cpts – event and teacher that are connected.
In the single-teacher.php template I want to show all the events of a techer, ordered by the most upcoming course to the most far away.
I try this –p2p_type( 'event_teacher' )->each_connected( $wp_query ); $connected_events = new WP_Query( array( 'post_type' => 'event', 'connected_type' => 'event_teacher', 'connected_items' => get_queried_object(), 'nopaging' => true, 'orderby' => 'date', 'order' => 'ASC', 'posts_per_page' => -1 ) );
This gives the correct results, but all events are ordered by date DESC not ASC.
I tried also this –
p2p_type( 'event_teacher' )->each_connected( $wp_query ); $connected_events = new WP_Query( array( 'post_type' => 'event', 'connected_type' => 'event_teacher', 'connected_items' => get_queried_object(), 'nopaging' => true, 'posts_per_page' => -1, 'connected_orderby' => 'date', 'connected_order' => 'ASC' ) );
but still nothing changed.
How could I orderby date ASC (or any other orderby) to the connected items fetched?Thanks ahead for any help
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘[Plugin: Posts 2 Posts] posts 2 posts – How to orderby by conneced posts’ is closed to new replies.