Tagged: Post Type, rename post type
Sorry, but you do not have the capability to view this topic
-
Supported
- Topics: 1
- Replies: 1
- Total posts: 2
Post count: 2Hi,
how can i safely rename post type name “department(s)” to something else? and what impact will it have on the already created departments? Do I have to so to mysql db?
or can i just edit de file departments.php? and if so where exactly?thank you very much
Paulo
function department_init() {
$labels = array(
'name' => _x( 'Departments', 'department', 'iva_theme_admin' ),
'singular_name' => _x( 'Department', 'department', 'iva_theme_admin' ),
'menu_name' => _x( 'Departments', 'admin menu', 'iva_theme_admin' ),
'name_admin_bar' => _x( 'Department', 'add new on admin bar', 'iva_theme_admin' ),
'add_new' => _x( 'Add New', 'department', 'iva_theme_admin' ),
'add_new_item' => __( 'Add New department', 'iva_theme_admin' ),
'new_item' => __( 'New department', 'iva_theme_admin' ),
'edit_item' => __( 'Edit department', 'iva_theme_admin' ),
'view_item' => __( 'View department', 'iva_theme_admin' ),
'all_items' => __( 'All departments', 'iva_theme_admin' ),
'search_items' => __( 'Search department', 'iva_theme_admin' ),
'parent_item_colon' => __( 'Parent department:', 'iva_theme_admin' ),
'not_found' => __( 'No department found.', 'iva_theme_admin' ),
'not_found_in_trash' => __( 'No department found in Trash.', 'iva_theme_admin' ),
);$iva_dept_slug = get_option('iva_dept_slug') ? get_option('iva_dept_slug') :'department';
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'exclude_from_search'=> false,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => $iva_dept_slug ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'menu_icon' => THEME_URI . '/medical/images/department-icon.png',
'supports' => array( 'title', 'editor', 'author', 'thumbnail' ),
);register_post_type( 'department', $args );
}/* Add custom columns to post list */
function set_custom_edit_department_columns( $columns ) {$columns['department_id'] = __( 'ID\'s', 'iva_theme_admin' );
$columns['post_thumbs'] = __('Thumbs', 'iva_theme_admin');return $columns;
}/* Display custom columns */
function custom_department_columns( $column, $post_id ) {
switch ( $column ) {
case 'department_id':
echo $post_id ;
break;
case 'post_thumbs':
echo the_post_thumbnail(array(50,50));
break;
}
}
add_action('manage_department_posts_custom_column', 'custom_department_columns', 10, 2);
add_filter('manage_edit-department_columns', 'set_custom_edit_department_columns');