Skip to content
scribu edited this page Apr 15, 2012 · 7 revisions

This repository is a slice of the full Posts 2 Posts repo, kept in sync via a git filter-branch command. It only contains the core API and is meant to be bundled with a theme.

You will also need to bundle the scbFramework code.

The directory layout looks like this:

/scb/
/p2p-core/
load.php

Here's what the load.php file should contain:

<?php
// scbFramework
foreach ( array(
	'scbUtil', 'scbOptions', 'scbForms', 'scbTable',
	'scbWidget', 'scbAdminPage', 'scbBoxesPage',
	'scbCron', 'scbHooks',
) as $className ) {
	if ( !class_exists( $className ) ) {
		include dirname( __FILE__ ) . '/scb/' . substr( $className, 3 ) . '.php';
	}
}

if ( !function_exists( 'scb_init' ) ) :
function scb_init( $callback ) {
	call_user_func( $callback );
}
endif;

// Posts 2 Posts core
if ( !function_exists( 'p2p_register_connection_type' ) ) {
	// TODO: replace APP_TD with your textdomain
	define( 'P2P_TEXTDOMAIN', APP_TD );

	foreach ( array(
		'storage', 'query', 'query-post', 'query-user', 'url-query',
		'util', 'side', 'type-factory', 'type', 'directed-type',
		'api'
	) as $file ) {
		require dirname( __FILE__ ) . "/p2p-core/$file.php";
	}

	// TODO: replace 'appthemes_first_run' with a hook that runs when the theme is activated
	add_action( 'appthemes_first_run', array( 'P2P_Storage', 'install' ) );
}
Clone this wiki locally