• Resolved JsonB123

    (@jsonb123)


    Is ordering at all possible via the orderby and order parameters? If so, where do these go, under filters?

    I was assuming that at least the order I connected the posts to a post would stay, but upon reloading the page, it wasn’t so. Not sure what order they are behaving by either; it’s not alphabetical nor is it by post ID.

    Also, just wanted to note how much I LOVE this plugin. Well done Scribu! Quality work as always.

    http://ww.wp.xz.cn/extend/plugins/posts-to-posts/

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    non_human

    (@non_human)

    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.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Posts 2 Posts] Ordering connected posts’ is closed to new replies.