Skip to content

Instantly share code, notes, and snippets.

@halfempty
Created September 1, 2015 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halfempty/792ba7ba811448754327 to your computer and use it in GitHub Desktop.
Save halfempty/792ba7ba811448754327 to your computer and use it in GitHub Desktop.
Sample Posts 2 Posts + The Event Calendar connections
<?php
/*
Plugin Name: Connections
*/
function clock_p2p_register_connections() {
p2p_register_connection_type( array(
'name' => 'posts_to_tribe_events',
'from' => 'post',
'to' => 'tribe_events',
'title' => array(
'from' => __( 'Related Events' ),
'to' => __( 'Related Posts' )
)
) );
p2p_register_connection_type( array(
'name' => 'tribe_events_to_tribe_events',
'from' => 'tribe_events',
'to' => 'tribe_events',
'reciprocal' => true,
'title' => array(
'from' => __( 'Related Events' ),
'to' => __( 'Related Events' )
)
) );
}
add_action( 'p2p_init', 'clock_p2p_register_connections' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment