2012年2月16日木曜日

custom post type x posts2postsのプラグインの組み合わせが便利すぎにゃん

マジ便利やで。


posts 2 posts が まぁ幅広ーくなったかんじ。



// function my_connection_types() {
// Make sure the Posts 2 Posts plugin is active.


if ( !function_exists( 'p2p_register_connection_type' ) )


return;


// Keep a reference to the connection type; we'll need it later


global $people_connection_type;


global $place_connection_type;


global $event_connection_type;


$place_connection_type = p2p_register_connection_type( array(


'from' => 'events',


'to' => 'places'


) );


$people_connection_type = p2p_register_connection_type( array(


'from' => 'events',


'to' => 'people'


) );


$event_connection_type = p2p_register_connection_type( array(


'from' => 'people',


'to' => 'places'


) );


}


add_action( 'init', 'my_connection_types', 100 );




Add Quick tag プラグイン custom posts の適応 wodpress

まぁここ見たら書いてあるんですけどね(´・ω・`)


http://wordpress.org/extend/plugins/addquicktag/




function.php


// add custom function to filter hook ‘addquicktag_post_types’



add_filter( 'addquicktag_post_types', 'my_addquicktag_post_types' );
/**
* Return array $post_types with custom post types
*
* @param $post_type Array
* @return $post_type Array
*/
function my_addquicktag_post_types( $post_types ) {

$post_types[] = 'my_custom_post_type1';
$post_types[] += 'my_custom_post_type2';
$post_types[] += 'my_custom_post_type3';

return $post_types;
}


てな感じで,配列にcustompost名をぶち込んでけばよいのだよ.