Skip to content

Commit

Permalink
Allow associations between posts and sessions with the Posts 2 Posts …
Browse files Browse the repository at this point in the history
…plugin
  • Loading branch information
danielbachhuber committed Sep 8, 2011
1 parent 440f7de commit 150cb12
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ class ona11

function __construct() {

$this->session = new ona11_session();

add_action( 'after_setup_theme', array( &$this, 'enqueue_resources' ) );
add_action( 'after_setup_theme', array( &$this, 'register_custom_taxonomies' ) );
add_action( 'after_setup_theme', array( &$this, 'associate_post_types' ) );

if ( !is_admin() ) {
require_once( 'php/template_tags.php' );
add_action( 'wp_head', 'ona11_head_title' );
add_action( 'wp_head', array( &$this, 'wp_head' ) );
}

$this->session = new ona11_session();

}

/**
Expand Down Expand Up @@ -69,6 +70,17 @@ function register_custom_taxonomies() {

}

function associate_post_types() {
if ( !function_exists( 'p2p_register_connection_type' ) )
return;

// Writers should be able to associate posts with sessions
p2p_register_connection_type( array(
'from' => 'post',
'to' => 'ona11_session'
) );
}

/**
* Other resources to add to the head
*/
Expand Down
2 changes: 1 addition & 1 deletion php/class.ona11_session.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ona11_session
*/
function __construct() {

add_action( 'init', array( &$this, 'create_post_type' ) );
add_action( 'after_setup_theme', array( &$this, 'create_post_type' ) );

// Load necessary scripts and stylesheets
add_action( 'admin_enqueue_scripts', array( &$this, 'add_admin_resources' ) );
Expand Down

0 comments on commit 150cb12

Please sign in to comment.