Change the default WordPress post name to News and replace the Dashicon.
<?php
// change all incidents of Post to News
function ccd_change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News';
$submenu['edit.php'][16][0] = 'News Tags';
echo '';
}
function ccd_change_post_object() {
global $wp_post_types;
$labels = &$wp_post_types['post']->labels;
$labels->name = 'News';
$labels->singular_name = 'News';
$labels->add_new = 'Add News';
$labels->add_new_item = 'Add News';
$labels->edit_item = 'Edit News';
$labels->new_item = 'News';
$labels->view_item = 'View News';
$labels->search_items = 'Search News';
$labels->not_found = 'No News found';
$labels->not_found_in_trash = 'No News found in Trash';
$labels->all_items = 'All News';
$labels->menu_name = 'News';
$labels->name_admin_bar = 'News';
}
add_action( 'admin_menu', 'ccd_change_post_label' );
add_action( 'init', 'ccd_change_post_object' );
// Change the pin icon to a megaphone
function ccd_menu_news_icon() {
global $menu;
foreach ( $menu as $key => $val ) {
if ( __( 'News') == $val[0] ) {
$menu[$key][6] = 'dashicons-megaphone';
}
}
}
add_action( 'admin_menu', 'ccd_menu_news_icon' );
// Change post messages
function ccd_news_messages( $messages ) {
global $post, $post_ID;
$messages['post'] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf( __( 'News Updated. <a href="%s">View News Post</a>' ), esc_url( get_permalink( $post_ID ) ) ),
2 => __( 'Custom field updated.' ),
3 => __( 'Custom field deleted.' ),
4 => __( 'News updated.' ),
/* translators: %s: date and time of the revision */
5 => isset( $_GET['revision'] ) ? sprintf( __( 'News post restored to revision from %s' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __( 'News published. <a href="%s">View News Post</a>' ), esc_url( get_permalink( $post_ID ) ) ),
7 => __( 'News saved.' ),
8 => sprintf( __( 'News submitted. <a target="_blank" href="%s">Preview News Post</a>' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ),
9 => sprintf( __( 'News scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview News Post</a>' ),
// translators: Publish box date format, see http://php.net/date
date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ) ),
10 => sprintf( __( 'News draft updated. <a target="_blank" href="%s">Preview News Post</a>' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ),
);
return $messages;
}
add_filter('post_updated_messages', 'ccd_news_messages');
?>
WordPress Snippet