本文整理汇总了PHP中p2p_register_connection_type函数的典型用法代码示例。如果您正苦于以下问题:PHP p2p_register_connection_type函数的具体用法?PHP p2p_register_connection_type怎么用?PHP p2p_register_connection_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了p2p_register_connection_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: my_connection_types
function my_connection_types() {
p2p_register_connection_type( array(
'name' => 'feat_to_feature',
'from' => 'article',
'to' => 'feature'
) );
}
开发者ID:supahseppe,项目名称:path-of-gaming,代码行数:7,代码来源:functions.php
示例2: sudweb_register_schedule_connections
function sudweb_register_schedule_connections()
{
if (!function_exists('p2p_register_connection_type')) {
return false;
}
p2p_register_connection_type(array('name' => 'schedule_to_place', 'from' => 'schedule', 'to' => 'place', 'cardinality' => 'many-to-one'));
}
开发者ID:rik,项目名称:wp-sudweb-theme,代码行数:7,代码来源:schedule.php
示例3: snhotel_p2p_register_connection
function snhotel_p2p_register_connection()
{
// Make sure the Posts 2 Posts plugin is active.
if (!function_exists('p2p_register_connection_type')) {
return;
}
p2p_register_connection_type(array('name' => 'event_to_offer', 'from' => 'snhotel_offer', 'to' => 'snhotel_event'));
p2p_register_connection_type(array('name' => 'event_to_facility', 'from' => 'snhotel_event', 'to' => 'snhotel_facility'));
p2p_register_connection_type(array('name' => 'room_to_offer', 'from' => 'snhotel_room', 'to' => 'snhotel_offer'));
/* p2p_register_connection_type( array(
'name' => 'facility_to_offer',
'from' => 'snhotel_facility',
'to' => 'snhotel_offer'
) ); */
/* //services
p2p_register_connection_type( array(
'name' => 'offer_to_services',
'from' => 'snhotel_offer',
'to' => 'snhotel_services'
) ); */
//offer
p2p_register_connection_type(array('name' => 'offer_to_facility', 'from' => 'snhotel_offer', 'to' => 'snhotel_facility'));
/* p2p_register_connection_type( array(
'name' => 'room_to_offer',
'from' => 'snhotel_offer',
'to' => 'snhotel_room'
) ); */
}
开发者ID:ratheeshpkr,项目名称:snhotel,代码行数:28,代码来源:posts-to-posts.php
示例4: impa_employee_connection_types
/**
* Connects employee post type to listing post type
*/
function impa_employee_connection_types()
{
if (!post_type_exists('listing') || !post_type_exists('employee')) {
return;
}
p2p_register_connection_type(array('name' => 'agents_to_listings', 'from' => 'employee', 'to' => 'listing'));
}
开发者ID:agentevolution,项目名称:impress-agents,代码行数:10,代码来源:functions.php
示例5: audiotheme_gigs_init
/**
* Register gig and venue post types and attach hooks to load related
* functionality.
*
* @since 1.0.0
* @uses register_post_type()
*/
function audiotheme_gigs_init()
{
// Register Gig custom post type.
register_post_type('audiotheme_gig', array('has_archive' => audiotheme_gigs_rewrite_base(), 'hierarchical' => false, 'labels' => array('name' => _x('Gigs', 'post type general name', 'audiotheme'), 'singular_name' => _x('Gig', 'post type singular name', 'audiotheme'), 'add_new' => _x('Add New', 'gig', 'audiotheme'), 'add_new_item' => __('Add New Gig', 'audiotheme'), 'edit_item' => __('Edit Gig', 'audiotheme'), 'new_item' => __('New Gig', 'audiotheme'), 'view_item' => __('View Gig', 'audiotheme'), 'search_items' => __('Search Gigs', 'audiotheme'), 'not_found' => __('No gigs found', 'audiotheme'), 'not_found_in_trash' => __('No gigs found in Trash', 'audiotheme'), 'all_items' => __('All Gigs', 'audiotheme'), 'menu_name' => __('Gigs', 'audiotheme'), 'name_admin_bar' => _x('Gigs', 'add new on admin bar', 'audiotheme')), 'menu_position' => 512, 'public' => true, 'register_meta_box_cb' => 'audiotheme_gig_edit_screen_setup', 'rewrite' => false, 'show_in_admin_bar' => true, 'show_in_menu' => 'audiotheme-gigs', 'show_in_nav_menus' => false, 'supports' => array('title', 'editor', 'thumbnail')));
// Register Venue custom post type.
register_post_type('audiotheme_venue', array('has_archive' => false, 'hierarchical' => false, 'labels' => array('name' => _x('Venues', 'post type general name', 'audiotheme'), 'singular_name' => _x('Venue', 'post type singular name', 'audiotheme'), 'add_new' => _x('Add New', 'venue', 'audiotheme'), 'add_new_item' => __('Add New Venue', 'audiotheme'), 'edit_item' => __('Edit Venue', 'audiotheme'), 'new_item' => __('New Venue', 'audiotheme'), 'view_item' => __('View Venue', 'audiotheme'), 'search_items' => __('Search Venues', 'audiotheme'), 'not_found' => __('No venues found', 'audiotheme'), 'not_found_in_trash' => __('No venues found in Trash', 'audiotheme'), 'all_items' => __('All Venues', 'audiotheme'), 'menu_name' => __('Venues', 'audiotheme'), 'name_admin_bar' => _x('Venues', 'add new on admin bar', 'audiotheme')), 'public' => false, 'publicly_queryable' => false, 'query_var' => 'audiotheme_venue', 'rewrite' => false, 'supports' => array('')));
// Register the relationship between gigs and venues.
p2p_register_connection_type(array('name' => 'audiotheme_venue_to_gig', 'from' => 'audiotheme_venue', 'to' => 'audiotheme_gig', 'cardinality' => 'one-to-many'));
// Hook into the rewrite generation filter and add custom rewrite rules.
add_filter('generate_rewrite_rules', 'audiotheme_gig_generate_rewrite_rules');
// Filter the query to make sure gigs are returned in a logical way.
add_filter('query_vars', 'audiotheme_gigs_register_query_vars');
add_action('pre_get_posts', 'audiotheme_pre_gig_query');
// Make sure the correct template is loaded depending on the request.
add_action('template_redirect', 'audiotheme_gig_template_redirect');
add_action('template_include', 'audiotheme_gig_template_include');
// Filter default permalinks to return the custom format.
add_filter('post_type_link', 'audiotheme_gig_permalink', 10, 4);
add_filter('post_type_archive_link', 'audiotheme_gigs_archive_link', 10, 2);
add_filter('wp_unique_post_slug', 'audiotheme_gig_unique_slug', 10, 6);
add_action('save_post_audiotheme_gig', 'audiotheme_gig_update_bad_slug', 10, 2);
add_filter('get_edit_post_link', 'get_audiotheme_venue_edit_link', 10, 2);
add_action('before_delete_post', 'audiotheme_gig_before_delete');
add_filter('post_class', 'audiotheme_gig_post_class', 10, 3);
}
开发者ID:sewmyheadon,项目名称:audiotheme,代码行数:32,代码来源:gigs.php
示例6: my_connection_types_display
function my_connection_types_display() {
p2p_register_connection_type( array(
'name' => 'display_to_gift',
'from' => 'display',
'to' => 'gift'
) );
}
开发者ID:qcstw-dev,项目名称:qcsasia,代码行数:7,代码来源:functions.php
示例7: sfhiv_group_event_connection
function sfhiv_group_event_connection()
{
// Make sure the Posts 2 Posts plugin is active.
if (!function_exists('p2p_register_connection_type')) {
return;
}
p2p_register_connection_type(array('name' => 'group_events', 'from' => 'sfhiv_group', 'to' => 'sfhiv_event', 'title' => array('from' => __('Events in Group', 'sfhiv'), 'to' => __('Group in Events', 'sfhiv')), 'admin_box' => array('show' => 'any', 'context' => 'advanced')));
}
开发者ID:nickdotreid,项目名称:SFHIV-Wordpress-Models-Plugin,代码行数:8,代码来源:sfhiv_group_event.php
示例8: post_type_connections
/**
* Post Type Connection
* Uses Posts2Posts
* @link https://github.com/scribu/wp-posts-to-posts/wiki
*/
function post_type_connections()
{
// Make Sure plugin is active
if (!function_exists('p2p_register_connection_type')) {
return;
}
p2p_register_connection_type(array('name' => 'sessions_to_speakers', 'from' => 'sc-sessions', 'to' => 'sc-speakers'));
}
开发者ID:hscale,项目名称:webento,代码行数:13,代码来源:plugin.php
示例9: test_factory_extra_args
function test_factory_extra_args()
{
$ctype = p2p_register_connection_type(array('name' => __FUNCTION__, 'from' => 'user', 'to' => 'page', 'admin_mock' => array('foo' => 'bar')));
$this->assertNotEmpty($this->mock->get_queue());
$this->assertEquals(0, count($this->mock->add_items('post', 'post')));
$this->assertEquals(1, count($this->mock->add_items('post', 'page')));
$this->assertEquals(1, count($this->mock->add_items('user')));
}
开发者ID:Olaw2jr,项目名称:wp-posts-to-posts,代码行数:8,代码来源:test-admin-factory.php
示例10: init
public function init()
{
if (!isset($this->args['post_types']) || empty($this->args['post_types'])) {
return;
}
p2p_register_connection_type(array('name' => APP_FAVORITES_CONNECTION, 'from' => (array) $this->args['post_types'], 'to' => 'user'));
parent::init();
}
开发者ID:kalushta,项目名称:darom,代码行数:8,代码来源:class-ajax-view-favorites.php
示例11: sfhiv_group_connection_to_users
function sfhiv_group_connection_to_users()
{
// Make sure the Posts 2 Posts plugin is active.
if (!function_exists('p2p_register_connection_type')) {
return;
}
p2p_register_connection_type(array('name' => 'group_members', 'from' => 'sfhiv_group', 'to' => 'user', 'title' => array('from' => __('Members in Group', 'sfhiv'), 'to' => __('Groups for Member', 'sfhiv')), 'fields' => array('hide' => array('title' => 'Hide Title', 'type' => 'checkbox'), 'title' => 'Title', 'weight' => 'Weight', 'group' => 'Grouping', 'show_contact_info' => array('title' => 'Contactable', 'type' => 'checkbox')), 'admin_box' => array('show' => 'any', 'context' => 'advanced')));
}
开发者ID:nickdotreid,项目名称:SFHIV-Wordpress-Models-Plugin,代码行数:8,代码来源:sfhiv_group_member.php
示例12: sudweb_register_talk_connections
function sudweb_register_talk_connections()
{
if (!function_exists('p2p_register_connection_type')) {
return false;
}
p2p_register_connection_type(array('name' => 'talk_to_speaker', 'from' => 'talk', 'to' => 'speaker', 'cardinality' => 'many-to-many'));
p2p_register_connection_type(array('name' => 'talk_to_schedule', 'from' => 'talk', 'to' => 'schedule', 'cardinality' => 'many-to-one'));
}
开发者ID:rik,项目名称:wp-sudweb-theme,代码行数:8,代码来源:talk.php
示例13: actors_and_movies
function actors_and_movies()
{
register_post_type('actor', array('public' => true, 'labels' => array('name' => 'Àctors', 'singular_name' => 'Àctor', 'search_items' => 'Search Àctors', 'new_item' => 'New Àctor', 'not_found' => 'No actors found.', 'add_new_item' => 'Add new àctor'), 'has_archive' => 'actors', 'supports' => array('title')));
register_post_type('movie', array('public' => true, 'labels' => array('name' => 'Movies', 'singular_name' => 'Movie', 'search_items' => 'Search movies', 'new_item' => 'New Movie', 'not_found' => 'No movies found.'), 'supports' => array('title')));
p2p_register_connection_type(array('name' => 'actor_movie', 'from' => 'actor', 'to' => 'movie', 'fields' => array('role' => 'Role', 'role_type' => array('title' => 'Role Type', 'values' => array('lead', 'secondary', 'episodic')), 'single_checkbox' => array('title' => 'Ya?', 'type' => 'checkbox'), 'color' => array('title' => 'Color', 'type' => 'checkbox', 'values' => array('white', 'red', 'green', 'blue'))), 'sortable' => 'any', 'prevent_duplicates' => false, 'context' => 'advanced', 'admin_box' => 'any', 'admin_column' => 'any', 'title' => array('from' => 'Played In', 'to' => 'Cast')));
p2p_register_connection_type(array('name' => 'actor_doubles', 'from' => 'actor', 'to' => 'actor', 'cardinality' => 'one-to-many', 'title' => array('from' => 'Doubles', 'to' => 'Main Actor'), 'data' => array('type' => 'doubles'), 'sortable' => 'order', 'admin_column' => 'any', 'can_create_post' => false, 'to_labels' => array('singular_name' => 'Double', 'search_items' => 'Search doubles', 'not_found' => 'No doubles found')));
p2p_register_connection_type(array('name' => 'actor_friends', 'from' => array('actor'), 'to' => 'actor', 'reciprocal' => true, 'title' => 'Friends with', 'data' => array('type' => 'friends')));
}
开发者ID:netconstructor,项目名称:wp-posts-to-posts,代码行数:8,代码来源:debug.php
示例14: actors_and_movies
static function actors_and_movies()
{
register_post_type('actor', array('public' => true, 'labels' => array('name' => 'Actors', 'singular_name' => 'Actor', 'search_items' => 'Search Actors', 'new_item' => 'New Actor', 'not_found' => 'No actors found.', 'add_new_item' => 'Add new àctor'), 'has_archive' => 'actors', 'supports' => array('title')));
register_post_type('movie', array('public' => true, 'labels' => array('name' => 'Movies', 'singular_name' => 'Movie', 'search_items' => 'Search movies', 'new_item' => 'New Movie', 'not_found' => 'No movies found.'), 'supports' => array('title')));
p2p_register_connection_type(array('name' => 'actor_movie', 'from' => 'actor', 'to' => 'movie', 'fields' => array('role' => 'Role', 'role_type' => array('title' => 'Role Type', 'values' => array('lead', 'secondary', '\\episodic'))), 'sortable' => 'any', 'prevent_duplicates' => false, 'admin_box' => array('show' => 'any', 'context' => 'advanced', 'priority' => 'high'), 'admin_column' => 'any', 'admin_dropdown' => 'any', 'title' => array('from' => 'Played In', 'to' => 'Cast')));
p2p_register_connection_type(array('name' => 'actor_doubles', 'from' => 'actor', 'to' => 'actor', 'cardinality' => 'one-to-many', 'title' => array('from' => 'Doubles', 'to' => 'Main Actor'), 'data' => array('type' => 'doubles'), 'sortable' => 'order', 'admin_column' => 'any', 'admin_dropdown' => 'any', 'can_create_post' => false, 'from_labels' => array('help' => 'The main actor this actor was doubling for.'), 'to_labels' => array('help' => 'Other actors that have played as doubles for this actor.', 'column_title' => 'XXX Doubles', 'singular_name' => 'Double', 'search_items' => 'Search doubles', 'not_found' => 'No doubles found')));
p2p_register_connection_type(array('name' => 'actor_friends', 'from' => array('actor'), 'to' => 'actor', 'reciprocal' => true, 'title' => 'Friends with', 'data' => array('type' => 'friends'), 'to_labels' => array('create' => 'Add friends'), 'admin_column' => 'any'));
}
开发者ID:Olaw2jr,项目名称:wp-posts-to-posts,代码行数:8,代码来源:debug.php
示例15: create_connection
/**
* Create a connection between registered post types and Rtbiz_Entity
*/
public function create_connection()
{
foreach ($this->p2p_mapping as $to_post_type => $connected_items) {
foreach ($connected_items as $from_post_type => $args) {
$args = array_merge(array('name' => $from_post_type . '_to_' . $to_post_type, 'from' => $from_post_type, 'to' => $to_post_type), $args);
p2p_register_connection_type($args);
}
}
}
开发者ID:chandra-patel,项目名称:rtbiz,代码行数:12,代码来源:class-rtbiz-p2p.php
示例16: my_connection_types
function my_connection_types()
{
$connection_args = array('name' => 'film2scene', 'from' => 'film', 'to' => 'scene', 'title' => array('from' => 'Scènes présentes dans ce film :', 'to' => 'Film dont est issue la scène :'), 'admin_box' => array('show' => 'any', 'context' => 'advanced'));
$connection_args2 = array('name' => 'scene2acteur', 'from' => 'scene', 'to' => 'acteur', 'title' => array('from' => 'Acteur dans cette scène :', 'to' => 'A joué dans les scènes :'), 'admin_box' => array('show' => 'any', 'context' => 'advanced'), 'fields' => array('fonction' => array('title' => 'Fonction', 'values' => array('tueur' => 'tueur', 'victime' => 'victime')), 'role' => array('title' => 'Role')));
$connection_args3 = array('name' => 'film2realisateur', 'from' => 'film', 'to' => 'realisateur', 'title' => array('from' => 'Réalisateur du film :', 'to' => 'A réalisé :'), 'admin_box' => array('show' => 'any', 'context' => 'advanced'));
p2p_register_connection_type($connection_args);
p2p_register_connection_type($connection_args2);
p2p_register_connection_type($connection_args3);
}
开发者ID:bertalFish,项目名称:panic-social-club,代码行数:9,代码来源:skamovie.php
示例17: _init_panel_connection
function _init_panel_connection()
{
// 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 $connect_panels;
$connect_panels = p2p_register_connection_type(array('id' => 'connect_panels', 'title' => 'Sidebar Panels', 'admin_box' => 'from', 'from' => 'page', 'to' => 'panel', 'sortable' => 'order'));
}
开发者ID:xeyefex,项目名称:Mixd-WordPress-Framework,代码行数:10,代码来源:post-types.php
示例18: connect_post_types
public function connect_post_types()
{
if (function_exists('p2p_register_connection_type')) {
add_action('p2p_init', function () {
p2p_register_connection_type(array('name' => 'podcast_to_product', 'from' => 'podcast', 'to' => 'product'));
p2p_register_connection_type(array('name' => 'podcast_clip_to_podcast', 'from' => 'podcast_clip', 'to' => 'podcast'));
p2p_register_connection_type(array('name' => 'podcast_clip_to_product', 'from' => 'podcast_clip', 'to' => 'product'));
});
}
}
开发者ID:nathanielks,项目名称:wp-podcast-post-type,代码行数:10,代码来源:PluginPublic.php
示例19: gd_list_p2p_connection
function gd_list_p2p_connection()
{
$all_postypes = geodir_get_posttypes();
if (!$all_postypes) {
$all_postypes = array('gd_place');
}
foreach ($all_postypes as $pt) {
p2p_register_connection_type(array('name' => $pt . '_to_gd_list', 'from' => $pt, 'to' => 'gd_list', 'admin_box' => array('show' => 'to', 'context' => 'side')));
}
}
开发者ID:poweronio,项目名称:mbsite,代码行数:10,代码来源:geodir_list_manager.php
示例20: register_connections
public static function register_connections()
{
if (self::$already_registered) {
return;
}
self::$already_registered = true;
p2p_register_connection_type(array('name' => self::LICENSE_TO_LICENSEKEY, 'from' => FOOLIC_CPT_LICENSE, 'to' => FOOLIC_CPT_LICENSE_KEY, 'to_query_vars' => array('orderby' => 'none'), 'from_query_vars' => array('orderby' => 'none'), 'can_create_post' => false, 'cardinality' => 'one-to-many', 'admin_column' => 'to', 'admin_dropdown' => 'to', 'title' => array('from' => __('License Keys', 'foolic'), 'to' => __('License', 'foolic')), 'to_labels' => array('column_title' => __('License', 'foolic')), 'from_labels' => array('create' => __('Select License', 'foolic')), 'admin_box' => array('show' => 'to', 'context' => 'side')));
p2p_register_connection_type(array('name' => self::LICENSEKEY_TO_DOMAINS, 'from' => FOOLIC_CPT_LICENSE_KEY, 'to' => FOOLIC_CPT_DOMAIN, 'title' => array('from' => __('Connected Domains', 'foolic'), 'to' => __('License Keys', 'foolic')), 'to_query_vars' => array('orderby' => 'none'), 'from_query_vars' => array('orderby' => 'none'), 'to_labels' => array('create' => __('Attach Domain', 'foolic')), 'admin_box' => array('show' => 'any', 'context' => 'advanced'), 'fields' => array('attached' => array('title' => 'Attached', 'type' => 'checkbox', 'default' => '1'), 'date_connected' => array('title' => 'Date Connected', 'type' => 'text', 'default_cb' => array('foolic_post_relationships', 'default_domain_connection_date')))));
p2p_register_connection_type(array('name' => self::USER_TO_LICENSEKEYS, 'from' => 'user', 'to' => FOOLIC_CPT_LICENSE_KEY, 'can_create_post' => false, 'cardinality' => 'one-to-many'));
p2p_register_connection_type(array('name' => self::LICENSE_TO_LICENSE, 'from' => FOOLIC_CPT_LICENSE, 'to' => FOOLIC_CPT_LICENSE, 'can_create_post' => false, 'admin_column' => 'to', 'cardinality' => 'many-to-many', 'sortable' => 'any', 'title' => array('from' => __('Can Upgrade From The Following Licenses', 'foolic'), 'to' => __('Available License Upgrade Paths', 'foolic')), 'to_labels' => array('create' => __('Add Upgrade Path (Reverse)', 'foolic')), 'from_labels' => array('create' => __('Add Upgrade Path', 'foolic')), 'admin_box' => array('show' => 'any', 'context' => 'advanced'), 'fields' => array('upgrade' => array('title' => 'Upgrade Short Description', 'type' => 'text'))));
do_action('foolic_p2p_register_connections');
}
开发者ID:brianlayman,项目名称:fooLicensing,代码行数:12,代码来源:post_relationships.php
注:本文中的p2p_register_connection_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论