• I just updated to 0.7, hoping to get some of that new “sexier” metabox action, but instead, I’ve got no metabox showing at all ??

    Has something changed in 0.7 that requires some kind of manual display settings? I can see that my relationships are still active, as my custom queries are still showing related assets, but I don’t even see the p2p metabox listed in the “screen options” tab…

    What would be even better would be if I could manually display the p2p metabox where I want (instead of on the right side). How could I generate it in the same “normal” column with my other custom metaboxes?

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

    (@scribu)

    Please paste the code you’re using to register the connection.

    Thread Starter Israel Curtis

    (@somatic)

    p2p_register_connection_type( array(
    	'from' => array('stills','videos'),
    	'to' => 'releases',
    ) );
    Plugin Author scribu

    (@scribu)

    Ah yes, p2p_register_connection_type() doesn’t accept arrays of post types anymore. This is fixed in the development version (0.8-alpha).

    For controling where the connection box appears, you can use the ‘context’ arg (the default is ‘side’):

    p2p_register_connection_type( array(
    	'from' => array('stills','videos'),
    	'to' => 'releases',
    	'context' => 'advanced'
    ) );
    Thread Starter Israel Curtis

    (@somatic)

    Thanks – the 0.8a fixed it.

    Context worked too, but wondering how I can change the order of metaboxes displaying – I know “normal” comes before “advanced”, but I’d prefer the connection box display in a specific order, among the other metaboxes I’m creating for my custom post type. That’s why I wondered if I could programmatically spawn it myself. Even better would be for me to be able to display the connection box UI components within another custom metabox I’ve created to display additional information about the connected posts.

    Many versions ago, I was actually able to do this by calling a p2p class directly:

    $args = array(
    	'from' => 'stills',
    	'to' => 'releases',
    	'box' => 'P2P_Box_2',
    	'title' => 'Foobar',
    	'reciprocal' => false,
    );
    $foo = new P2P_Box_Multiple($args, false, 0);

    This doesn’t work anymore – is there a new way I can “inject” the connection box UI elsewhere?

    Plugin Author scribu

    (@scribu)

    I’m afraid you’re on your own there.

    If you need that much control, you’re probably better off writing your own UI from scratch and using the available API to create the connections.

    Thread Starter Israel Curtis

    (@somatic)

    I have a custom post type that I’m registering with p2p, but I don’t actually want to display the connection box on the edit page for that type – I only want to create p2p connections programmatically (not allow user to do so manually).

    I took a wild guess and put

    p2p_register_connection_type( array(
    	'from' => 'foo',
    	'to' => 'bar',
    	'context' => 'none'
    ) );

    in my p2p_register_connection_type.

    It seems to work – the metabox isn’t showing, but am I breaking something by doing this?

    Plugin Author scribu

    (@scribu)

    At the moment, p2p_register_connection_type() is just for creating metaboxes, so you can skip it entirely.

    Thread Starter Israel Curtis

    (@somatic)

    but if I skip it, can I still use p2p_connect() to establish the relationship?

    Somehow I thought I had to declare the relationship between types first with p2p_register_connection_type() and then p2p_connect() to create each individual connection…

    Plugin Author scribu

    (@scribu)

    Yes, you can still use p2p_connect() etc.

    As I said before, p2p_register_connection_type() is just for the UI.

    If you don’t trust me on that, just look at the code. ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Posts 2 Posts] p2p metabox disappears in 0.7’ is closed to new replies.