Skip to content

Instantly share code, notes, and snippets.

@StewartJohn
Forked from billerickson/gist:1624373
Last active October 20, 2015 21:02
Show Gist options
  • Save StewartJohn/75e36129f348194db636 to your computer and use it in GitHub Desktop.
Save StewartJohn/75e36129f348194db636 to your computer and use it in GitHub Desktop.
Manually Curated Related Posts - Establish the Connection
<?php
/**
* Related Post Connection
* Forked from:
* @author Bill Erickson
* @link http://www.billerickson.net/manually-curated-related-posts/
*
* @uses Posts2Posts
* @link https://github.com/scribu/wp-posts-to-posts/wiki
*/
function be_post_type_connections() {
p2p_register_connection_type( array(
'name' => 'courses_to_units', // unique name
'from' => 'course',
'to' => 'unit',
) );
p2p_register_connection_type( array(
'name' => 'units_to_lessons', // unique name
'from' => 'unit',
'to' => 'lesson',
) );
p2p_register_connection_type( array(
'name' => 'lessons_to_sublessons', // unique name
'from' => 'lesson',
'to' => 'sublesson',
) );
}
add_action( 'p2p_init', 'be_post_type_connections' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment