Recent Update: Renaming Posts
-
Hi, thanks for the most recent update. However, I noticed that when renaming Posts to anything else then it only renames the menu item but everywhere else still refers to Posts and not the new name.
I normally use the following in my functions.php file to rename Posts to Articles and thought I would post it here to show the areas that I also rename to keep consistency throughout the site.// Rename Posts to Articles add_action( 'init', 'change_post_object_label' ); function change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = 'Articles'; $submenu['edit.php'][5][0] = 'All Articles'; $submenu['edit.php'][10][0] = 'Add New Article'; $submenu['edit.php'][16][0] = 'Tags'; echo ''; } add_action( 'admin_menu', 'change_post_menu_label' ); function change_post_object_label() { global $wp_post_types; $labels = &$wp_post_types['post']->labels; $labels->name = 'Articles'; $labels->singular_name = 'Article'; $labels->add_new = 'Add New Article'; $labels->add_new_item = 'Add New Article'; $labels->edit_item = 'Edit Article'; $labels->new_item = 'Article'; $labels->view_item = 'View Article'; $labels->search_items = 'Search Articles'; $labels->not_found = 'No articles found'; $labels->not_found_in_trash = 'No articles found in Trash'; } add_action( 'admin_bar_menu', 'change_wp_admin_bar', 80 ); function change_wp_admin_bar( $wp_admin_bar ) { $new_post_node = $wp_admin_bar->get_node( 'new-post' ); $new_post_node->title = 'Article'; // Change title $wp_admin_bar->add_node( $new_post_node ); // Update Node }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Recent Update: Renaming Posts’ is closed to new replies.