Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ///
- /// Register the custom post type
- ///
- //Setting Up Your Custom Post Type
- add_action('init', 'register_rc', 1); // Set priority to avoid plugin conflicts
- function register_rc() { // A unique name for our function
- $labels = array( // Used in the WordPress admin
- 'name' => _x('Resources', 'post type general name'),
- 'singular_name' => _x('Resource', 'post type singular name'),
- 'add_new' => _x('Add New', 'Resource'),
- 'add_new_item' => __('Add New Resource'),
- 'edit_item' => __('Edit Resource'),
- 'new_item' => __('New Resource'),
- 'view_item' => __('View Resource '),
- 'search_items' => __('Search Resources'),
- 'not_found' => __('Nothing found'),
- 'not_found_in_trash' => __('Nothing found in Trash')
- );
- $args = array(
- 'labels' => $labels, // Set above
- 'public' => true, // Make it publicly accessible
- 'hierarchical' => false, // No parents and children here
- 'menu_position' => 5, // Appear right below "Posts"
- 'has_archive' => 'resources', // Activate the archive
- 'supports' => array('title','editor','comments','thumbnail','custom-fields'),
- );
- register_post_type( 'resource', $args ); // Create the post type, use options above
- ///
- /// Set up the presenter
- ///
- $labels_presenter = array(
- 'name' => _x( 'Presenters', 'taxonomy general name' ),
- 'singular_name' => _x( 'Presenter', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Presenters' ),
- 'popular_items' => __( 'Popular Presenters' ),
- 'all_items' => __( 'All Presenters' ),
- 'edit_item' => __( 'Edit Presenter' ),
- 'update_item' => __( 'Update Presenter' ),
- 'add_new_item' => __( 'Add New Presenter' ),
- 'new_item_name' => __( 'New Presenter Name' ),
- 'separate_items_with_commas' => __( 'Separate presenters with commas' ),
- 'add_or_remove_items' => __( 'Add or remove presenters' ),
- 'choose_from_most_used' => __( 'Choose from the most used presenters' )
- );
- register_taxonomy(
- 'presenters', // The name of the custom taxonomy
- array( 'resource' ), // Associate it with our custom post type
- array(
- 'rewrite' => array( // Use "presenter" instead of "presenters" in the permalink
- 'slug' => 'presenter'
- ),
- 'labels' => $labels_presenter
- )
- );
- ////
- //// This is for adding the topics
- ////
- $labels_topics = array(
- 'name' => _x( 'Topics', 'taxonomy general name' ),
- 'singular_name' => _x( 'Topic', 'taxonomy singular name' ),
- 'search_items' => __( 'Search Topics' ),
- 'all_items' => __( 'All Topics' ),
- 'parent_item' => __( 'Parent Topic' ),
- 'parent_item_colon' => __( 'Parent Topic:' ),
- 'edit_item' => __( 'Edit Topic' ),
- 'update_item' => __( 'Update Topic' ),
- 'add_new_item' => __( 'Add New Topic' ),
- 'new_item_name' => __( 'New Topic Name' ),
- );
- register_taxonomy(
- 'topics', // The name of the custom taxonomy
- array( 'resource' ), // Associate it with our custom post type
- array(
- 'hierarchical' => true,
- 'rewrite' => array(
- 'slug' => 'topic', // Use "topic" instead of "topics" in permalinks
- 'hierarchical' => true // Allows sub-topics to appear in permalinks
- ),
- 'labels' => $labels_topics
- )
- );
- }
- ///
- ///
- /// This is for the menu code
- ///
- ///
- add_action("bp_nav_items", "show_user_link");
- function show_user_link() {
- if (!is_user_logged_in())
- return;
- echo('<ul id="nav">');
- if (bp_is_home())
- {
- echo('<li class="selected">');
- }
- else
- {
- echo('<li>');
- }
- echo('<a href="' . bp_loggedin_user_domain() . 'profile">My Profile</a>');
- echo('</li>');
- echo('</ul>');
- }
- ?>
Add Comment
Please, Sign In to add comment