• Resolved argeee

    (@argeee)


    Hi Scribu,
    I have seen the documentation (thanks for that) and while trying to upgrade the funtion to the new way of doing things I’m running into a problem.
    I have a single custom post type that relates to multiple other post types. If I do this:

    $my_connection_type = p2p_register_connection_type( array(
      'from' => 'series',
      'to' => array( 'post', 'page' )
      'sortable' => '_order'
    ) );

    I don’t get anything on an interface in the custom post.
    Doing it the old fashion way:

    $my_connection_type = p2p_register_connection_type( array(
            'from' => 'post',
            'to' => 'series'
    	'sortable' => '_order'
    
        ) );
        $my_connection_type = p2p_register_connection_type( array(
            'from' => 'page',
            'to' => 'series',
    	'sortable' => '_order'
        ) );

    Everything is ok.

    The main reason for me to change was to get the new sortable functionality.

    thanks in advance

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter argeee

    (@argeee)

    Sorry,
    One additional thing…the series type is related to itself:

    $my_connection_type = p2p_register_connection_type( array(
      'from' => 'series',
      'to' => array('series','post', 'page' )
      'sortable' => '_order'
    ) );

    thanks

    Plugin Author scribu

    (@scribu)

    One additional thing…the series type is related to itself:

    Those kinds of connection types don’t support ordering.

    If you connect serie-a to serie-b, then serie-b is automatically connected to serie-a, which would make the ordering meaningless.

    Thread Starter argeee

    (@argeee)

    Hi Scribu,
    What about the syntax in my first post? Is that possible?

    As for making sense, I think it has.
    For example, you might have product-a related to product-b and product-c. Whereas product-b might be related to product-a, but also product-x. In other words, they are not reciprocal.
    This means that you might be interested in setting an order…

    thanks

    Plugin Author scribu

    (@scribu)

    What about the syntax in my first post? Is that possible?

    Yep, this works for me:

    function init_my_stuff() {
    	global $my_connection_type;
    
    	register_post_type( 'series', array(
    		'label' => 'Series',
    		'public' => true
    	) );
    
    	$my_connection_type = p2p_register_connection_type( array(
    		'from' => 'series',
    		'to' => array( 'post', 'page' ),
    		'sortable' => '_order'
    	) );
    }
    add_action( 'init', 'init_my_stuff' );
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Posts 2 Posts] Single from and array of to(s)’ is closed to new replies.