Created
October 2, 2015 17:58
-
-
Save surefirewebserv/4f9679a3d19ea0e454e6 to your computer and use it in GitHub Desktop.
Sample Set Up with Multiple Relationships
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Don't copy the php tag above. | |
function sfws_books_to_relationship() { | |
p2p_register_connection_type( array( | |
'name' => 'bookes_to_authors', //Give it a name that you can reference | |
'from' => 'books', // This can be the slug name of your CPT as well | |
'to' => 'authors' // This can be the slug name of your CPT as well | |
) ); | |
p2p_register_connection_type( array( | |
'name' => 'bookes_to_illustrators', //Give it a name that you can reference | |
'from' => 'books', // This can be the slug name of your CPT as well | |
'to' => 'illustrators' // This can be the slug name of your CPT as well | |
) ); | |
p2p_register_connection_type( array( | |
'name' => 'bookes_to_publishers', //Give it a name that you can reference | |
'from' => 'books', // This can be the slug name of your CPT as well | |
'to' => 'publishers' // This can be the slug name of your CPT as well | |
) ); | |
} | |
add_action( 'p2p_init', 'sfws_books_to_relationship' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment