/* SETUP TAXONOMIES
======================================== */
function mfields_create_taxonomies() {
register_taxonomy( "wordpress-functions", 'post', array(
'hierarchical' => true,
'show_tagcloud' => false,
'update_count_callback' => '_update_post_term_count',
'labels' => array(
'name' => 'Functions',
'singular_name' => 'Function',
'search_items' => 'Search Function',
'all_items' => 'All Function',
'parent_item' => 'Parent Function',
'parent_item_colon' => 'Parent Function:',
'edit_item' => 'Edit Function',
'update_item' => 'Update Function',
'add_new_item' => 'Add a New Function',
'new_item_name' => 'New Function'
)
) );
register_taxonomy( "wordpress-hooks", 'post', array(
'hierarchical' => true,
'show_tagcloud' => false,
'update_count_callback' => '_update_post_term_count',
'labels' => array(
'name' => 'Hooks',
'singular_name' => 'Hook',
'search_items' => 'Search Hook',
'all_items' => 'All Hook',
'parent_item' => 'Parent Hook',
'parent_item_colon' => 'Parent Hook:',
'edit_item' => 'Edit Hook',
'update_item' => 'Update Hook',
'add_new_item' => 'Add a New Hook',
'new_item_name' => 'New Hook Name'
)
) );
register_taxonomy( "topics", 'post', array(
'hierarchical' => true,
'show_tagcloud' => false,
'update_count_callback' => '_update_post_term_count',
'labels' => array(
'name' => 'Topics',
'singular_name' => 'Topic',
'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 a New Topic',
'new_item_name' => 'New Topic Name'
)
) );
register_taxonomy_for_object_type( 'topics', 'page' );
}
add_action( 'init', 'mfields_create_taxonomies', 1 );
/**
* Register linear post_type "Bookmark".
* @uses register_post_type()
*/
function mfields_register_bookmark_post_type() {
register_post_type( 'mfields_bookmark', array(
'public' => true,
'can_export' => true,
'has_archive' => 'bookmarks',
'rewrite' => array( 'slug' => 'bookmark', 'with_front' => false ),
'menu_position' => 3,
'supports' => array(
'title',
'editor',
'thumbnail',
'custom-fields'
),
'labels' => array(
'name' => 'Bookmarks',
'singular_name' => 'Bookmark',
'add_new' => 'Add New',
'add_new_item' => 'Add New Bookmark',
'edit_item' => 'Edit Bookmark',
'new_item' => 'New Bookmark',
'view_item' => 'View Bookmark',
'search_items' => 'Search Bookmark',
'not_found' => 'No Bookmarks found',
'not_found_in_trash' => 'No Bookmarks found in Trash'
)
)
);
}
add_action( 'init', 'mfields_register_bookmark_post_type', 0 );
/**
* Register taxonomies for the "Bookmark" post_type.
* @uses register_taxonomy()
*/
function mfields_register_bookmark_taxonomies() {
register_taxonomy( 'mfields_bookmark_type', 'mfields_bookmark', array(
'hierarchical' => true,
'query_var' => 'type',
'rewrite' => array( 'slug' => 'type' ),
'show_tagcloud' => false,
'update_count_callback' => '_update_post_term_count',
'labels' => array(
'name' => 'Types',
'singular_name' => 'Type',
'search_items' => 'Search Types',
'all_items' => 'All Types',
'parent_item' => 'Parent Type',
'parent_item_colon' => 'Parent Type:',
'edit_item' => 'Edit Type',
'update_item' => 'Update Type',
'add_new_item' => 'Add a New Type',
'new_item_name' => 'New Type Name'
)
) );
register_taxonomy( 'mfields_bookmark_source', 'mfields_bookmark', array(
'hierarchical' => true,
'query_var' => 'source',
'rewrite' => array( 'slug' => 'source' ),
'show_tagcloud' => true,
'update_count_callback' => '_update_post_term_count',
'labels' => array(
'name' => 'Sources',
'singular_name' => 'Source',
'search_items' => 'Search Sources',
'all_items' => 'All Sources',
'parent_item' => 'Parent Source',
'parent_item_colon' => 'Parent Source:',
'edit_item' => 'Edit Source',
'update_item' => 'Update Source',
'add_new_item' => 'Add a New Source',
'new_item_name' => 'New Source'
)
) );
register_taxonomy_for_object_type( 'topics', 'mfields_bookmark' );
}
add_action( 'init', 'mfields_register_bookmark_taxonomies', 1 );