Plugin Author
scribu
(@scribu)
Thanks for the kind words, but I can’t take all the credit for this release. 🙂
On the front-end, you can order them like so:
$connected = get_posts( array(
'suppress_filters' => false,
'connected' => $post->ID,
'post_type' => 'foo',
'orderby' => 'title',
'order' => 'asc'
) );
If you need explicit ordering, a potential solution would be to define an ‘order’ field, which you then populate manually (like ye olde menu_order for pages).
Then, you would have to do some SQL hacking to make use of that custom ‘order’ field.
I was just wondering something similar – ideally I’m looking for some way to drag-drop the connected posts into order in the admin, then retrieve them in that order every time.
I also wanted to say thanks for this plugin – it was very useful in a recent project of mine.
Then, you would have to do some SQL hacking to make use of that custom ‘order’ field.
Scribu, can you help with the example of that, please?
If there’s p2p meta_key = “order” and values “1”, “2”..etc. how would you connect posts with p2pmeta table? custom SQL query with inner join?
Plugin Author
scribu
(@scribu)
@non_human: There’s now an API for that:
https://github.com/scribu/wp-posts-to-posts/wiki/Connection-ordering
ideally I’m looking for some way to drag-drop the connected posts into order in the admin, then retrieve them in that order every time.
The development version (0.9-alpha2) has the drag-and-drop part.