Skip to content

Instantly share code, notes, and snippets.

@yoren
Created March 19, 2013 07:24
Show Gist options
  • Save yoren/5194306 to your computer and use it in GitHub Desktop.
Save yoren/5194306 to your computer and use it in GitHub Desktop.
WordPress: Change wordpress posts to news
<?php
/**
* Change wordpress posts to news
*
* @link http://new2wp.com/snippet/change-wordpress-posts-post-type-news/
*/
function change_post_menu_label() {
global $menu;
global $submenu;
$menu[5][0] = '首頁管理';
$submenu['edit.php'][5][0] = '輪播圖片';
$submenu['edit.php'][10][0] = '新增輪播圖片';
//$submenu['edit.php'][16][0] = __( 'News Tags', 'fichet' );
echo '';
}
function change_post_object_label() {
global $wp_post_types;
global $wp_taxonomies;
unset( $wp_taxonomies['post_tag'] );
$wp_taxonomies['category']->object_type = array( 'attachment' );
$labels = &$wp_post_types['post']->labels;
$labels->name = '輪播圖片';
$labels->singular_name = '輪播圖片';
$labels->add_new = '新增輪播圖片';
$labels->add_new_item = '新增輪播圖片';
$labels->edit_item = '編輯輪播圖片';
$labels->new_item = '輪播圖片';
$labels->view_item = '檢視輪播圖片';
$labels->search_items = '搜尋輪播圖片';
$labels->not_found = '找不到輪播圖片';
$labels->not_found_in_trash = '回收桶內沒有輪播圖片';
}
add_action( 'init', 'change_post_object_label' );
add_action( 'admin_menu', 'change_post_menu_label' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment