WordPress.org

Support

Support » Plugins and Hacks » Posts 2 Posts » Problem with multiple connexions

Problem with multiple connexions

  • Hi, I’m using posts 2 posts on some blog I’m working on, and I can’t figure out how to use multiple connections.

    I have 2 custom post types (game & subject) that both have the same custome taxonomy (platform)

    These post types are linked to the wordpress posts using P2P like this :

    function connection_types() {
    	p2p_register_connection_type(
    		array(
    			'name' => 'posts_games',
    			'from' => 'post',
    			'to' => 'games',
    			'reciprocal' => true,
    			'duplicate_connections' => true
    		)
    	);
    	p2p_register_connection_type(
    		array(
    			'name' => 'posts_subjects',
    			'from' => 'post',
    			'to' => 'subjects',
    			'reciprocal' => true,
    			'duplicate_connections' => true
    		)
    	);
    }
    add_action( 'p2p_init', 'connection_types' );

    Then on my platform taxonomy page, I have two queries, the first one gets the games and subjects that have the current taxonomy.

    Then I’m trying to query all the wordpress posts connected to these with the following query :

    $connected = new WP_Query( array(
    	'post_type' => array('post'),
    	'connected_type' => array('posts_subjects', 'posts_games'),
    	'connected_items' => $gameorsubject->get_posts(),
    	'connected_direction' => 'any',
    	'nopaging' => false,
    	'paged' => $paged
    ) );

    This query works for some taxonomies, and for some, it doesn’t return any post (it should).

    Did I forget anything ? Am I using the plugin like I should ?
    Thanks a lot for your help

    update : i just checked the sql query, and it’s not the same for each taxonomy, how’s that possible ?

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Do you have any custom taxonomies? Are these possibly the one’s that don’t render the connected posts?

    Could you describe your taxonomies and then give an example of what works and what doesn’t.

    Ted

    Just listening in.

    starfennec, how do you make the sql query visible btw? Might come in handy when debugging why something is not working.
    Sascha

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with multiple connexions’ is closed to new replies.
Skip to toolbar