/** * Register the new post type "portfolio" */ function register_post_types() { $labels = array('name' => __('Projects', 'bp-portfolio'), 'singular' => __('Project', 'bp-portfolio')); // Set up the argument array for register_post_type() $args = array('label' => __('Projects', 'bp-portfolio'), 'labels' => $labels, 'public' => false, 'show_ui' => true, 'supports' => array('title'), 'rewrite' => TRUE, 'rewrite' => array('slug' => 'project', 'with_front' => FALSE)); register_post_type('portfolio', $args); parent::register_post_types(); }
/** * Creating a custom post type album for BuddyPress Media */ function register_post_types() { $labels = array('name' => __('Albums', 'bp-media'), 'singular_name' => __('Album', 'bp-media'), 'add_new' => __('Create', 'bp-media'), 'add_new_item' => __('Create Album', 'bp-media'), 'edit_item' => __('Edit Album', 'bp-media'), 'new_item' => __('New Album', 'bp-media'), 'all_items' => __('All Albums', 'bp-media'), 'view_item' => __('View Album', 'bp-media'), 'search_items' => __('Search Albums', 'bp-media'), 'not_found' => __('No album found', 'bp-media'), 'not_found_in_trash' => __('No album found in Trash', 'bp-media'), 'parent_item_colon' => '', 'menu_name' => __('Albums', 'bp-media')); $args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => false, 'show_in_menu' => false, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title', 'author', 'thumbnail', 'excerpt', 'comments')); register_post_type('bp_media_album', $args); /* Set up labels for the post type */ $labels = array('name' => __('Media', 'bp-media'), 'singular' => __('Media', 'bp-media'), 'add_new' => __('Add New Media', 'bp-media')); /* Set up the argument array for register_post_type() */ $args = array('label' => __('Media', 'bp-media'), 'labels' => $labels, 'description' => 'BuddyPress Media\'s Media Files', 'public' => true, 'show_ui' => false, 'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields')); register_post_type('bp_media', $args); parent::register_post_types(); }
/** * Register the rendez_vous post type * * @package Rendez_Vous * @subpackage Component * * @since Rendez Vous (1.0.0) */ function register_post_types() { // Set up some labels for the post type $rdv_labels = array('name' => __('Rendez-vous', 'rendez-vous'), 'singular' => _x('Rendez-vous', 'rendez-vous singular', 'rendez-vous'), 'menu_name' => _x('Rendez-vous', 'rendez-vous menu name', 'rendez-vous'), 'all_items' => _x('All Rendez-vous', 'rendez-vous all items', 'rendez-vous'), 'singular_name' => _x('Rendez-vous', 'rendez-vous singular name', 'rendez-vous'), 'add_new' => _x('Add New Rendez-vous', 'rendez-vous add new', 'rendez-vous'), 'edit_item' => _x('Edit Rendez-vous', 'rendez-vous edit item', 'rendez-vous'), 'new_item' => _x('New Rendez-vous', 'rendez-vous new item', 'rendez-vous'), 'view_item' => _x('View Rendez-vous', 'rendez-vous view item', 'rendez-vous'), 'search_items' => _x('Search Rendez-vous', 'rendez-vous search items', 'rendez-vous'), 'not_found' => _x('No Rendez-vous Found', 'rendez-vous not found', 'rendez-vous'), 'not_found_in_trash' => _x('No Rendez-vous Found in Trash', 'rendez-vous not found in trash', 'rendez-vous')); $rdv_args = array('label' => _x('Rendez-vous', 'rendez-vous label', 'rendez-vous'), 'labels' => $rdv_labels, 'public' => false, 'rewrite' => false, 'show_ui' => false, 'show_in_admin_bar' => false, 'show_in_nav_menus' => false, 'capabilities' => rendez_vous_get_caps(), 'capability_type' => array('rendez_vous', 'rendez_vouss'), 'delete_with_user' => true, 'supports' => array('title', 'author')); // Register the post type for attachements. register_post_type('rendez_vous', $rdv_args); parent::register_post_types(); }
function register_post_types() { /* Set up labels for the post type */ $labels = array('name' => __('Media', 'bp-media'), 'singular' => __('Media', 'bp-media'), 'add_new' => __('Add New Media', 'bp-media')); /* Set up the argument array for register_post_type() */ $args = array('label' => __('Media', 'bp-media'), 'labels' => $labels, 'description' => 'BuddyPress Media Component\'s Media Files', 'public' => true, 'show_ui' => false, 'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields')); register_post_type('bp_media', $args); parent::register_post_types(); }
/** * If your component needs to store data, it is highly recommended that you use WordPress * custom post types for that data, instead of creating custom database tables. * * In the future, BuddyPress will have its own bp_register_post_types hook. For the moment, * hook to init. See BP_Example_Component::__construct(). * * @package BuddyPress_Skeleton_Component * @since 1.6 * @see http://codex.wordpress.org/Function_Reference/register_post_type */ function register_post_types() { // Set up some labels for the post type $labels = array('name' => __('High Fives', 'bp-example'), 'singular' => __('High Five', 'bp-example')); // Set up the argument array for register_post_type() $args = array('label' => __('High Fives', 'bp-example'), 'labels' => $labels, 'public' => false, 'show_ui' => true, 'supports' => array('title')); // Register the post type. // Here we are using $this->id ('example') as the name of the post type. You may // choose to use a different name for the post type; if you register more than one, // you will have to declare more names. register_post_type($this->id, $args); parent::register_post_types(); }
/** * registering post type */ function register_post_types() { global $bp, $wpdb; if (empty($bp->pages->{$this->id}->slug)) { $directory_ids = bp_core_get_directory_page_ids(); $page_id = $directory_ids[$this->id]; $page_slug = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM {$wpdb->base_prefix}posts WHERE ID = %d AND post_status = 'publish' ", $page_id)); } else { $page_slug = $bp->pages->{$this->id}->slug; } $slug = isset($page_slug) ? $page_slug : BP_CHECKINS_SLUG; // Set up some labels for the post type $labels = array('name' => __('Places', 'bp-checkins'), 'singular' => __('Place', 'bp-checkins'), 'menu_name' => __('Community Places', 'bp-checkins'), 'all_items' => __('All Places', 'bp-checkins'), 'singular_name' => __('Place', 'bp-checkins'), 'add_new' => __('Add New Place', 'bp-checkins'), 'add_new_item' => __('Add New Place', 'bp-checkins'), 'edit_item' => __('Edit Place', 'bp-checkins'), 'new_item' => __('New Place', 'bp-checkins'), 'view_item' => __('View Place', 'bp-checkins'), 'search_items' => __('Search Places', 'bp-checkins'), 'not_found' => __('No Places Found', 'bp-checkins'), 'not_found_in_trash' => __('No Places Found in Trash', 'bp-checkins')); $args = array('label' => __('Place', 'bp-checkins'), 'labels' => $labels, 'public' => false, 'rewrite' => array('slug' => $slug . '/place', 'with_front' => false), 'show_ui' => true, 'supports' => array('title', 'editor', 'author', 'excerpt', 'comments', 'custom-fields'), 'menu_icon' => BP_CHECKINS_PLUGIN_URL_IMG . '/community-places-post-type-icon.png', 'taxonomies' => array('places_category')); // Register the post type. register_post_type('places', $args); parent::register_post_types(); }
/** * Set up post types. * * @since BuddyPress (2.4.0) */ public function register_post_types() { // Emails if (bp_is_root_blog() && !is_network_admin()) { register_post_type(bp_get_email_post_type(), apply_filters('bp_register_email_post_type', array('description' => _x('BuddyPress emails', 'email post type description', 'buddypress'), 'labels' => bp_get_email_post_type_labels(), 'menu_icon' => 'dashicons-email', 'public' => false, 'publicly_queryable' => bp_current_user_can('bp_moderate'), 'query_var' => false, 'rewrite' => false, 'show_in_admin_bar' => false, 'show_ui' => bp_current_user_can('bp_moderate'), 'supports' => bp_get_email_post_type_supports()))); } parent::register_post_types(); }
/** * registering BuddyDrive custom post types * * @uses buddydrive_get_folder_post_type() to get the BuddyFolder post type * @uses buddydrive_get_file_post_type() to get the BuddyFile post type * @uses register_post_type() to register the post type */ public function register_post_types() { // Set up some labels for the post type $labels_file = array('name' => __('BuddyFiles', 'buddydrive'), 'singular' => __('BuddyFile', 'buddydrive'), 'menu_name' => __('BuddyDrive Files', 'buddydrive'), 'all_items' => __('All BuddyFiles', 'buddydrive'), 'singular_name' => __('BuddyFile', 'buddydrive'), 'add_new' => __('Add New BuddyFile', 'buddydrive'), 'add_new_item' => __('Add New BuddyFile', 'buddydrive'), 'edit_item' => __('Edit BuddyFile', 'buddydrive'), 'new_item' => __('New BuddyFile', 'buddydrive'), 'view_item' => __('View BuddyFile', 'buddydrive'), 'search_items' => __('Search BuddyFiles', 'buddydrive'), 'not_found' => __('No BuddyFiles Found', 'buddydrive'), 'not_found_in_trash' => __('No BuddyFiles Found in Trash', 'buddydrive')); $args_file = array('label' => __('BuddyFile', 'buddydrive'), 'labels' => $labels_file, 'public' => false, 'rewrite' => false, 'show_ui' => false, 'show_in_admin_bar' => false, 'supports' => array('title', 'editor', 'author')); // Register the post type for files. register_post_type(buddydrive_get_file_post_type(), $args_file); $labels_folder = array('name' => __('BuddyFolders', 'buddydrive'), 'singular' => __('BuddyFolder', 'buddydrive'), 'menu_name' => __('BuddyDrive Folders', 'buddydrive'), 'all_items' => __('All BuddyFolders', 'buddydrive'), 'singular_name' => __('BuddyFolder', 'buddydrive'), 'add_new' => __('Add New BuddyFolder', 'buddydrive'), 'add_new_item' => __('Add New BuddyFolder', 'buddydrive'), 'edit_item' => __('Edit BuddyFolder', 'buddydrive'), 'new_item' => __('New BuddyFolder', 'buddydrive'), 'view_item' => __('View BuddyFolder', 'buddydrive'), 'search_items' => __('Search BuddyFolders', 'buddydrive'), 'not_found' => __('No BuddyFolders Found', 'buddydrive'), 'not_found_in_trash' => __('No BuddyFolders Found in Trash', 'buddydrive')); $args_folder = array('label' => __('BuddyFolder', 'buddydrive'), 'labels' => $labels_folder, 'public' => false, 'rewrite' => false, 'show_ui' => false, 'show_in_admin_bar' => false, 'supports' => array('title', 'editor', 'author')); // Register the post type for files. register_post_type(buddydrive_get_folder_post_type(), $args_folder); parent::register_post_types(); }