-
Notifications
You must be signed in to change notification settings - Fork 1
Bundling in a plugin
scribu edited this page Feb 26, 2013
·
2 revisions
For a plugin, this is how the load.php file should look like:
<?php
/*
Plugin Name: P2P Bundle Example
Author: scribu
*/
require dirname( __FILE__ ) . '/scb/load.php';
scb_init( 'example_init' );
function example_init() {
add_action( 'plugins_loaded', 'example_load_p2p_core', 20 );
add_action( 'init', 'example_connection_types' );
}
function example_load_p2p_core() {
if ( function_exists( 'p2p_register_connection_type' ) )
return;
// TODO: replace APP_TD with your textdomain
define( 'P2P_TEXTDOMAIN', APP_TD );
require_once dirname( __FILE__ ) . '/p2p-core/init.php';
// TODO: can't use activation hook
add_action( 'admin_init', array( 'P2P_Storage', 'install' ) );
}
function example_connection_types() {
p2p_register_connection_type( array(
'name' => 'example_connection_type',
'from' => 'post',
'to' => 'user'
) );
}