News
if ( ! function_exists('custom_post_type_news') ) {
// Register Custom Post Type
function custom_post_type_news() {
$labels = array(
'name' => _x( 'News', 'Post Type General Name', 'mnxonline' ),
'singular_name' => _x( 'News', 'Post Type Singular Name', 'mnxonline' ),
'menu_name' => __( 'News', 'mnxonline' ),
'name_admin_bar' => __( 'News', 'mnxonline' ),
'archives' => __( 'News Archives', 'mnxonline' ),
'attributes' => __( 'Item Attributes', 'mnxonline' ),
'parent_item_colon' => __( 'Parent News:', 'mnxonline' ),
'all_items' => __( 'All News', 'mnxonline' ),
'add_new_item' => __( 'Add New News', 'mnxonline' ),
'add_new' => __( 'Add New', 'mnxonline' ),
'new_item' => __( 'New News', 'mnxonline' ),
'edit_item' => __( 'Edit News', 'mnxonline' ),
'update_item' => __( 'Update News', 'mnxonline' ),
'view_item' => __( 'View News', 'mnxonline' ),
'view_items' => __( 'View Items', 'mnxonline' ),
'search_items' => __( 'Search News', 'mnxonline' ),
'not_found' => __( 'Not found', 'mnxonline' ),
'not_found_in_trash' => __( 'Not found in Trash', 'mnxonline' ),
'featured_image' => __( 'Featured Image', 'mnxonline' ),
'set_featured_image' => __( 'Set featured image', 'mnxonline' ),
'remove_featured_image' => __( 'Remove featured image', 'mnxonline' ),
'use_featured_image' => __( 'Use as featured image', 'mnxonline' ),
'insert_into_item' => __( 'Insert into news', 'mnxonline' ),
'uploaded_to_this_item' => __( 'Uploaded to this news', 'mnxonline' ),
'items_list' => __( 'News list', 'mnxonline' ),
'items_list_navigation' => __( 'News list navigation', 'mnxonline' ),
'filter_items_list' => __( 'Filter news list', 'mnxonline' ),
);
$rewrite = array(
'slug' => 'news',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$capabilities = array(
'edit_post' => 'edit_news',
'read_post' => 'read_news',
'delete_post' => 'delete_news',
'edit_posts' => 'edit_news',
'edit_others_posts' => 'edit_others_news',
'publish_posts' => 'publish_news',
'read_private_posts' => 'read_private_news',
);
$args = array(
'label' => __( 'News', 'mnxonline' ),
'description' => __( 'News', 'mnxonline' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'post-formats' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-megaphone',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => 'news',
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capabilities' => $capabilities,
);
register_post_type( 'news', $args );
}
add_action( 'init', 'custom_post_type_news', 0 );
}