display order of connections

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.

Read More

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 ?

Related posts

Leave a Reply

3 comments

  1. 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.

  2. 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;