WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] Multiple P2P metaboxes (5 posts)

  1. superwillyfoc
    Member
    Posted 1 year ago #

    Hi,
    I have 2 post types which I want to be related using Posts 2 Posts. In the "A" post type I need to have two metaboxes, where the editor can check some "B" post types in both metaboxes. I need it because I want to display the related "B" types in the "A" template in two different blocks.
    Is it possible with the actual P2P API?

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

  2. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    I need it because I want to display the related "B" types in the "A" template in two different blocks.

    Could you be more specific? What is the criteria for differentiating between the two blocks?

  3. superwillyfoc
    Member
    Posted 1 year ago #

    Hi Scribu,
    thanks for your reply. I mean something like this:

    As an example, I have the post type "Landing" and the post type "Album". I need that the user could choose some "albums" in two different metaboxes while editing a "landing" post type. I think I need it, because in the template (frontend) there should be two different blocks showing both manual selections.

  4. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    The cleanest way would be to create 2 distinct connection types, between the same post types:

    p2p_register_connection_type( array(
      'name' => 'other_albums',
      'from' => 'album',
      'to' => 'landing'
    ) );
    
    p2p_register_connection_type( array(
      'name' => 'recommended_albums',
      'from' => 'album',
      'to' => 'landing'
    ) );
  5. superwillyfoc
    Member
    Posted 1 year ago #

    Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.