• Resolved seocadiz

    (@seocadiz)


    Hi,
    I installed the development version and still have the same problem described has solved in here:
    http://wordpress.org/support/topic/plugin-posts-2-posts-still-missing-data-after-141?replies=31

    So i post it here again, if someone can help me.

    Here is my code:

    The function:

    function my_connection_types() {
    
    		p2p_register_connection_type( array(
    			'name' => 'pages_to_pages',
    			'from' => 'page',
    			'to' => 'page',
    			'reciprocal' => true,
    			'sortable' => 'any'
    	) );
    }
    add_action( 'p2p_init', 'my_connection_types' );

    Printing connected pages:

    $connected = new WP_Query( array(
      'connected_type' => 'pages_to_pages',
      'connected_items' => get_queried_object(),
      'nopaging' => true,
    ) );
    
    // Display connected pages
    if ( $connected->have_posts() ) :
    ?>
    <h3>Related pages:</h3>
    <ul>
    <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
    	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    </ul>
    
    <?php
    // Prevent weirdness
    wp_reset_postdata();
    
    endif;

    And i still get the error:

    Warning: Could not find direction(s). in /public_html/wp-content/plugins/posts-to-posts/core/query-post.php on line 16

    http://wordpress.org/extend/plugins/posts-to-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author scribu

    (@scribu)

    All you have to do is add ‘connected_direction’:

    $connected = new WP_Query( array(
      'connected_type' => 'pages_to_pages',
      'connected_items' => get_queried_object(),
      'connected_direction' => 'from',
      'nopaging' => true,
    ) );

    Besides ‘from’, you can also try ‘to’ and ‘any’.

    Thread Starter seocadiz

    (@seocadiz)

    Solved! Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Warning: Could not find direction(s) (…) Line 16’ is closed to new replies.