Blog Posts
if ( ! function_exists('create_blog') ) {
// Register Custom Post Type
function create_blog() {
$labels = array(
'name' => 'Blog Posts',
'singular_name' => 'Blog Post',
'menu_name' => 'Blog',
'name_admin_bar' => 'Blog Posts',
'archives' => 'Blog',
'attributes' => 'Post Attributes',
'parent_item_colon' => 'Parent Post:',
'all_items' => 'All Posts',
'add_new_item' => 'Add New Post',
'add_new' => 'Add New',
'new_item' => 'New Post',
'edit_item' => 'Edit Post',
'update_item' => 'Update Post',
'view_item' => 'View Post',
'view_items' => 'View Post',
'search_items' => 'Search Post',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not found in Trash',
'featured_image' => 'Featured Image',
'set_featured_image' => 'Set featured image',
'remove_featured_image' => 'Remove featured image',
'use_featured_image' => 'Use as featured image',
'insert_into_item' => 'Insert into post',
'uploaded_to_this_item' => 'Uploaded to this post',
'items_list' => 'Blog Posts list',
'items_list_navigation' => 'Posts list navigation',
'filter_items_list' => 'Filter posts list',
);
$rewrite = array(
'slug' => 'blog',
'with_front' => false,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => 'Blog Post',
'description' => 'Used for Blog',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions', 'page-attributes' ),
'taxonomies' => array( 'blog_category', 'blog_tag' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-welcome-write-blog',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'query_var' => 'blog',
'rewrite' => $rewrite,
'capability_type' => 'page',
);
register_post_type( 'blog', $args );
}
add_action( 'init', 'create_blog', 0 );
}