WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] No posts available in meta box (22 posts)

  1. conradh
    Member
    Posted 4 years ago #

    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!

  2. scribu
    Member
    Plugin Author

    Posted 4 years ago #

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

  3. conradh
    Member
    Posted 4 years ago #

    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' );
  4. scribu
    Member
    Plugin Author

    Posted 4 years ago #

    It's working fine on my test install.

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

  5. conradh
    Member
    Posted 4 years ago #

    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.

  6. conradh
    Member
    Posted 4 years ago #

    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.

  7. scribu
    Member
    Plugin Author

    Posted 4 years ago #

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

  8. conradh
    Member
    Posted 4 years ago #

    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?

  9. scribu
    Member
    Plugin Author

    Posted 4 years ago #

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

  10. conradh
    Member
    Posted 4 years ago #

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

  11. Cristiano
    Member
    Posted 4 years ago #

    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!

  12. scribu
    Member
    Plugin Author

    Posted 4 years ago #

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

  13. Cristiano
    Member
    Posted 4 years ago #

    It was activated and didn´t work... now, I deactivated it and activated it again, and it´s ok! :)

  14. qwik3r
    Member
    Posted 4 years ago #

    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

  15. ronbme
    Member
    Posted 4 years ago #

    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.

  16. qwik3r
    Member
    Posted 4 years ago #

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

  17. ronbme
    Member
    Posted 4 years ago #

    I imagine he's been busy doing other things, like working on WordPress 3.0 and 3.1. ;)

  18. qwik3r
    Member
    Posted 4 years ago #

    Lol that doesn't matter, if you have a production plugin out that does not work with the latest versions of the software but a beta that does you should update the production one...

  19. scribu
    Member
    Plugin Author

    Posted 4 years ago #

    You're the only one experiencing that problem, from what I can tell.

    I will release the next version just as soon as I get around to fixing one remaining bug.

    Please refrain from giving me release management advice in the future. Thanks.

  20. qwik3r
    Member
    Posted 4 years ago #

    I am NOT the only one experiencing the problem and you know this because you replied to another thread where someone was experiencing the same exact thing, your "release" version doesn't appear to save the connection in 3.0 or 3.01. And I am not telling you what to do but it's good practice to have your releases working if they are in the WP repo so don't take that as me insulting you.

  21. qwik3r
    Member
    Posted 4 years ago #

    I appreciate your plugin very much and your hard work so I think you may have misunderstood that I wasn't giving you 'advice'. I think you're doing a great job, just trying to shed the light on some potential issues that you may not be aware of, that's all mate.

  22. scribu
    Member
    Plugin Author

    Posted 4 years ago #

    Ok, no hard feelings. :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic