function my_connection_types() { p2p_register_connection_type( array( 'name' => 'feat_to_feature', 'from' => 'article', 'to' => 'feature' ) ); }
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')); }
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' ) ); */ }
/** * 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')); }
/** * 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); }
function my_connection_types_display() { p2p_register_connection_type( array( 'name' => 'display_to_gift', 'from' => 'display', 'to' => 'gift' ) ); }
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'))); }
/** * 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')); }
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'))); }
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(); }
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'))); }
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')); }
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'))); }
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')); }
/** * 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); } } }
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); }
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')); }
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')); }); } }
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'))); } }
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'); }
/** * Registers p2p connections * * @since 0.1.0 */ public function p2p_connections() { // Check to make sure function exists first if (!function_exists('p2p_register_connection_type')) { return false; } if (count($this->settings) == 0) { return false; } foreach ($this->settings as $setting) { p2p_register_connection_type($setting); } }
function test_column_title() { $ctype = p2p_register_connection_type(array('name' => __FUNCTION__, 'from' => 'post', 'to' => 'page', 'from_labels' => array('column_title' => 'POST COLUMN'), 'to_labels' => array('column_title' => 'PAGE COLUMN'))); // from $mock = new P2P_Column_Mock($ctype->set_direction('from')); $columns = $mock->add_column(array()); $this->assertCount(1, $columns); $this->assertEquals('POST COLUMN', reset($columns)); // to $mock = new P2P_Column_Mock($ctype->set_direction('to')); $columns = $mock->add_column(array()); $this->assertCount(1, $columns); $this->assertEquals('PAGE COLUMN', reset($columns)); }
/** * Set up relationships using Posts to Posts plugin. * * Default settings for p2p_register_connection_type: * 'cardinality' => 'many-to-many' * 'reciprocal' => false * * @link https://github.com/scribu/wp-posts-to-posts/wiki/p2p_register_connection_type */ public function register_post_relationships() { /* * Functions to functions, methods and hooks */ p2p_register_connection_type(array('name' => 'functions_to_functions', 'from' => 'wp-parser-function', 'to' => 'wp-parser-function', 'self_connections' => 'true', 'title' => array('from' => 'Uses Functions', 'to' => 'Used by Functions'))); p2p_register_connection_type(array('name' => 'functions_to_methods', 'from' => 'wp-parser-function', 'to' => 'wp-parser-method', 'title' => array('from' => 'Uses Methods', 'to' => 'Used by Functions'))); p2p_register_connection_type(array('name' => 'functions_to_hooks', 'from' => 'wp-parser-function', 'to' => 'wp-parser-hook', 'title' => array('from' => 'Uses Hooks', 'to' => 'Used by Functions'))); /* * Methods to functions, methods and hooks */ p2p_register_connection_type(array('name' => 'methods_to_functions', 'from' => 'wp-parser-method', 'to' => 'wp-parser-function', 'title' => array('from' => 'Uses Functions', 'to' => 'Used by Methods'))); p2p_register_connection_type(array('name' => 'methods_to_methods', 'from' => 'wp-parser-method', 'to' => 'wp-parser-method', 'self_connections' => 'true', 'title' => array('from' => 'Uses Methods', 'to' => 'Used by Methods'))); p2p_register_connection_type(array('name' => 'methods_to_hooks', 'from' => 'wp-parser-method', 'to' => 'wp-parser-hook', 'title' => array('from' => 'Used by Methods', 'to' => 'Uses Hooks'))); }
/** * Registers P2P post relationships. */ function register_post_relationships() { /* * Functions to functions, methods and hooks */ p2p_register_connection_type(array('name' => 'functions_to_functions', 'from' => 'wp-parser-function', 'to' => 'wp-parser-function', 'can_create_post' => false, 'self_connections' => true, 'from_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'to_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'title' => array('from' => __('Uses Functions', 'wporg'), 'to' => __('Used by Functions', 'wporg')))); p2p_register_connection_type(array('name' => 'functions_to_methods', 'from' => 'wp-parser-function', 'to' => 'wp-parser-method', 'can_create_post' => false, 'from_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'to_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'title' => array('from' => __('Uses Methods', 'wporg'), 'to' => __('Used by Functions', 'wporg')))); p2p_register_connection_type(array('name' => 'functions_to_hooks', 'from' => 'wp-parser-function', 'to' => 'wp-parser-hook', 'can_create_post' => false, 'from_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'to_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'title' => array('from' => __('Uses Hooks', 'wporg'), 'to' => __('Used by Functions', 'wporg')))); /* * Methods to functions, methods and hooks */ p2p_register_connection_type(array('name' => 'methods_to_functions', 'from' => 'wp-parser-method', 'to' => 'wp-parser-function', 'can_create_post' => false, 'from_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'to_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'title' => array('from' => __('Uses Functions', 'wporg'), 'to' => __('Used by Methods', 'wporg')))); p2p_register_connection_type(array('name' => 'methods_to_methods', 'from' => 'wp-parser-method', 'to' => 'wp-parser-method', 'can_create_post' => false, 'self_connections' => true, 'from_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'to_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'title' => array('from' => __('Uses Methods', 'wporg'), 'to' => __('Used by Methods', 'wporg')))); p2p_register_connection_type(array('name' => 'methods_to_hooks', 'from' => 'wp-parser-method', 'to' => 'wp-parser-hook', 'can_create_post' => false, 'from_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'to_query_vars' => array('orderby' => 'post_title', 'order' => 'ASC'), 'title' => array('from' => __('Used by Methods', 'wporg'), 'to' => __('Uses Hooks', 'wporg')))); }
/** * Sets up the order system * @return void */ function appthemes_setup_orders() { $args = array('labels' => array('name' => __('Orders', APP_TD), 'singular_name' => __('Order', APP_TD), 'add_new' => __('Add New', APP_TD), 'add_new_item' => __('Add New Order', APP_TD), 'edit_item' => __('Edit Order', APP_TD), 'new_item' => __('New Order', APP_TD), 'view_item' => __('View Order', APP_TD), 'search_items' => __('Search Orders', APP_TD), 'not_found' => __('No orders found', APP_TD), 'not_found_in_trash' => __('No orders found in Trash', APP_TD), 'parent_item_colon' => __('Parent Order:', APP_TD), 'menu_name' => __('Orders', APP_TD)), 'hierarchical' => false, 'supports' => array('author', 'custom-fields'), 'public' => true, 'show_ui' => true, 'show_in_menu' => 'app-payments', 'rewrite' => array('slug' => 'order')); register_post_type(APPTHEMES_ORDER_PTYPE, apply_filters('appthemes_order_ptype_args', $args)); $statuses = array(APPTHEMES_ORDER_PENDING => _n_noop('Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', APP_TD), APPTHEMES_ORDER_FAILED => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', APP_TD), APPTHEMES_ORDER_COMPLETED => _n_noop('Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>', APP_TD), APPTHEMES_ORDER_ACTIVATED => _n_noop('Activated <span class="count">(%s)</span>', 'Activated <span class="count">(%s)</span>', APP_TD)); foreach ($statuses as $status => $translate_string) { register_post_status($status, array('public' => true, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => $translate_string)); } $args = appthemes_payments_get_args(); $initial_ptypes = $args['items_post_types']; if (!is_array($initial_ptypes)) { $initial_ptypes = array($initial_ptypes); } $post_types = apply_filters('appthemes_order_item_posts_types', $initial_ptypes); $post_types[] = APPTHEMES_ORDER_PTYPE; p2p_register_connection_type(array('name' => APPTHEMES_ORDER_CONNECTION, 'from' => APPTHEMES_ORDER_PTYPE, 'to' => $post_types, 'cardinality' => 'many-to-many', 'admin_box' => false, 'prevent_duplicates' => false, 'self_connections' => true)); APP_Item_Registry::register('_regional-tax', __('Regional Taxes', APP_TD), array(), 99); }
function sd_connection_types() { p2p_register_connection_type(array('name' => 'professors_to_courses', 'from' => 'professors', 'to' => 'courses')); }
/** * Register custom Post2Post relationships */ function register_achievement_relationships() { // Grab all our registered achievement types and loop through them $achievement_types = badgeos_get_achievement_types_slugs(); if (is_array($achievement_types) && !empty($achievement_types)) { foreach ($achievement_types as $achievement_type) { // Connect steps to each achievement type // Used to get an achievement's required steps (e.g. This badge requires these 3 steps) p2p_register_connection_type(array('name' => 'step-to-' . $achievement_type, 'from' => 'step', 'to' => $achievement_type, 'admin_box' => false, 'fields' => array('order' => array('title' => __('Order', 'badgeos'), 'type' => 'text', 'default' => 0)))); // Connect each achievement type to a step // Used to get a step's required achievement (e.g. this step requires earning Level 1) p2p_register_connection_type(array('name' => $achievement_type . '-to-step', 'from' => $achievement_type, 'to' => 'step', 'admin_box' => false, 'fields' => array('order' => array('title' => __('Order', 'badgeos'), 'type' => 'text', 'default' => 0)))); } } }
function p2p_connections() { p2p_register_connection_type(array('name' => 'state_to_faq', 'from' => 'state', 'to' => 'faq')); }
/** * Connect forum to docs * * @since 1.0.0 * @return void */ function edd_bbp_connect_forum_to_docs() { p2p_register_connection_type(array('name' => 'forums_to_docs', 'from' => 'forum', 'to' => 'docs')); }
function anp_meetings_connection_types() { p2p_register_connection_type(array('name' => 'meeting_to_agenda', 'from' => 'meeting', 'to' => 'agenda', 'reciprocal' => true, 'cardinality' => 'one-to-one', 'admin_column' => true, 'admin_dropdown' => 'to', 'sortable' => 'any', 'title' => array('from' => __('Agenda', 'meeting'), 'to' => __('Meeting', 'meeting')))); p2p_register_connection_type(array('name' => 'meeting_to_summary', 'from' => 'meeting', 'to' => 'summary', 'reciprocal' => true, 'cardinality' => 'one-to-one', 'admin_column' => true, 'admin_dropdown' => 'to', 'sortable' => 'any', 'title' => array('from' => __('Summary', 'meeting'), 'to' => __('Meeting', 'meeting')))); p2p_register_connection_type(array('name' => 'meeting_to_proposal', 'from' => 'meeting', 'to' => 'proposal', 'reciprocal' => true, 'cardinality' => 'one-to-many', 'admin_column' => true, 'admin_dropdown' => 'any', 'sortable' => 'any', 'title' => array('from' => __('Proposals', 'meeting'), 'to' => __('Meeting', 'meeting')))); }