• Resolved conradh

    (@conradh)


    Probably a really silly oversight but I have installed the Posts 2 Posts plugin and cannot select posts to create the relationships.

    I have the following code in my functions.php:

    if ( function_exists('p2p_register_connection_type') ) {
            function my_connection_types() {
                    p2p_register_connection_type('dataset', 'data', true);
            }
            add_action('init', 'my_connection_types', 100);
    }

    The meta box to select connected posts shows on the edit screen of each type but when I enter the name of a post, nothing ever appears that I can select. I have tried creating new posts of each type and reinstalling the plugin. Please let me know what I am missing to get this working.

    This looks like a great plugin and I’m looking forward to digging in with it. Thanks!

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

    (@scribu)

    Can you paste the code you use to register the post types?

    Thread Starter conradh

    (@conradh)

    Thanks for taking a look at this!

    function ds_posttypes() {
    	register_post_type( 'data',
    		array(
    			'label' => __('data'),
    			'singular_label' => __('data'),
    			'public' => true,
                            'menu_position' => 5,
    			'supports' => array( 'title', 'editor', 'excerpt' ),
    			'capability_type' => 'post',
    			'rewrite' => array('slug' => 'data'),
    			'query_var' => 'data',
    		)
    	);
            register_post_type( 'dataset',
    		array(
    			'label' => __('datasets'),
    			'singular_label' => __('dataset'),
    			'public' => true,
                            	'menu_position' => 6,
    	                        'hierarchical' => true,
    			'supports' => array( 'title', 'editor', 'excerpt', 'page-attributes' ),
    			'capability_type' => 'post',
    			'rewrite' => array('slug' => 'dataset'),
    			'query_var' => 'dataset',
    		)
    	);
    }
    
    add_action( 'init', 'ds_posttypes' );
    Plugin Author scribu

    (@scribu)

    It’s working fine on my test install.

    Please install Firebug and check the ajax response when looking for posts to connect to.

    Thread Starter conradh

    (@conradh)

    Hi Scribu –

    Thanks for your help with this. I realized I accidentally sent you the wrong code for the post types I registered where I am having this issue. The post types I am registering are identical to the code I sent previously, but have an “hs_” prefix in the first parameter, ie:

    register_post_type( 'hs_dataset...'

    When I looked at the ajax response, it appears that the underscore and everything after it is not being sent. Here are the parameters that are being sent in the GET, copied directly from Firebug:

    action p2p_search
    post_type hs
    q test

    Please let me know what you think. Thanks again.

    Thread Starter conradh

    (@conradh)

    To try to verify the issue, I copied the URL from the GET request and appended on the rest of the correct pot type name including the underscore. The response looked like the list of posts of that type I would expect to be returned.

    Plugin Author scribu

    (@scribu)

    I can reproduce it now. Should be fixed in the development version (0.4-alpha2).

    Thread Starter conradh

    (@conradh)

    Looks like it’s working now. Thanks for your attention and the quick fix! Much appreciated.

    One question… Since the relationship is bidirectional, I thought that once I selected a connection on one side, it would be displayed on the other as well but that was not the case. Should it be or did I miss something?

    Plugin Author scribu

    (@scribu)

    Yes, it should be and it’s working on my end.

    Thread Starter conradh

    (@conradh)

    Looks like it’s working fine on newly created relationships. Thanks for the help, and the plugin!

    I′m using the 0.4-beta version.
    I have the following code on my functions.php:

    function my_connection_types() {
    	if ( !function_exists('p2p_register_connection_type') )
    		return;
    
    	p2p_register_connection_type( 'texto', 'materia' );
    }
    add_action('init', 'my_connection_types', 100);

    The connection field appears on my “texto” post type… I can select a “materia” to connect to, but when I save the changes, the connection disappears… and it says “no connection”.

    What is wrong?
    thanks!

    Plugin Author scribu

    (@scribu)

    Did you re-activate the plugin after updating to 0.4-beta ?

    It was activated and didn′t work… now, I deactivated it and activated it again, and it′s ok! ??

    I’m not sure where I can grab the 0.4-beta but your .03 version does not save the connection as stated above, I am experiencing the same problem

    qwik3r,

    You can click on the link “development version” above in scribu’s comment, or you can go to the plugin page and click on “Other versions”.
    Then click on “Development version” to download it.

    Yep that is what I did and it appears to be working. He should really update the production version since its basically useless.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘[Plugin: Posts 2 Posts] No posts available in meta box’ is closed to new replies.