Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to control the order in which connections are displayed ?

I've got a Articles => Books connection so that in each article I can quote a number of books. I want to display the quoted books in the footnotes of the article.

Currently, if I create say three books connections and then display them at the bottom of my article, I will get them in reverse order. Can I change that ?

share|improve this question

3 Answers 3

Yes, there is a way to do this, since version 0.8:

https://github.com/scribu/wp-posts-to-posts/wiki/Connection-ordering

share|improve this answer

I know this question is old, but I just spent an hour researching this problem as well.

Within the main post that has multiple things related to it, in the sidebar (where connections are created), you can drag and drop to reorder the connected posts! That is how they will appear when called. Very intuitive once you realize it's there, but not immediately obvious. Good luck.

share|improve this answer

you could pass Order & Orderby Parameters

your code would be something like,

while ( have_posts() ) : the_post();
    $connected_writers = get_posts( array(
        'post_type' => 'writer',
        'nopaging' => true,
        'connected_to' => $post->ID,
        'suppress_filters' => false,
        'orderby' => 'title',
        'order' => 'DESC'
    ) );

    foreach ( $connected_writers as $writer ) {
        echo $writer->post_title;
    }
endwhile;
share|improve this answer
    
Doesn't seem to work. Whether I include 'order' => 'DESC' or not, the display order remains the same : –  Mike Jun 19 '11 at 12:18
    
Anybody ? There must be a way to do this –  Mike Jun 25 '11 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.