WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] Admin Metaboxes not Displaying Correctly (3 posts)

  1. Derek Perkins
    Member
    Posted 2 years ago #

    I am using P2P to store information about affiliate links. I have two custom post types, 'shoe' and 'shinguard' that I am connecting to the 'store' post type. I am storing the product id, affiliate link and price as fields attached to the connection.

    If I go into either the shoe or shinguard edit page, it shows the correct admin metabox that allows me to connect the product to a store. If however I go to the store page, it only shows me the shoe metabox. That metabox shows any shinguards that were connected via the shinguard metabox, but on the store edit page, I'd expect to see two separate metaboxes, one for shoes and one for shinguards. I tried changing 'reciprocal' to be false, but that had no effect on the display.

    When I query P2P myself, it returns the results that I am expecting, e.g. all stores with their connected shoes and/or shinguards.

    I would prefer to not create different connections per store per type, because regardless of the post type connected to the store, it will always be storing the same information. I feel that everything works now except for the admin side. I want to make sure that I am not using the connection in an unstable way that will cause problems in the future.

    p2p_register_connection_type(
    	array(
    		'name' => 'aff_info',
    		'from' => 'store',
    		'to' => array( 'shoe', 'shinguard' ),
    		'reciprocal' => true,
    		'fields' => array(
    			'aff_id' => 'ID',
    			'aff_url' => 'URL',
    			'aff_price' => 'Price',
    		)
    	)
    );

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

  2. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    The labels are misleading. Although it says 'Shoes', it actually displays both shoes and shinguards in the same metabox.

    The labels can be customised:

    https://github.com/scribu/wp-posts-to-posts/wiki/Admin-box-display

    PS: The 'reciprocal' flag is not needed at all in this case.

  3. Derek Perkins
    Member
    Posted 2 years ago #

    Great, thanks for that.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic