Suppose you want your blog to have a separate section so Use This code genearte your separate custom post.
My ‘post_type’=>’blogheart’ if you want to change replace with your value.
Let’s Create a Custom Post Type
Here we shall create a custom post type plugin which will display favorite movie reviews. Lets get started.
- Step 1: Create directory in your theme ‘blogheart’.
- Step 2: Create PHP File ‘blogheart-post-type.php’ at below define code.
- Step 3: open function.php.
Add This code in function.php
require_once (TEMPLATEPATH . '/blogheart/blogheart-post-type.php');
<?php add_action( 'init', 'register_cpt_blogheart' ); function register_cpt_blogheart() { $labels = array( 'name' => _x( 'Blog Heart', 'blogheart' ), 'singular_name' => _x( 'blogheart', 'blogheart' ), 'add_new' => _x( 'Add New', 'blogheart' ), 'add_new_item' => _x( 'Add New blogheart', 'blogheart' ), 'edit_item' => _x( 'Edit blogheart', 'blogheart' ), 'new_item' => _x( 'New blogheart', 'blogheart' ), 'view_item' => _x( 'View blogheart', 'blogheart' ), 'search_items' => _x( 'Search Blog Heart', 'blogheart' ), 'not_found' => _x( 'No blog heart found', 'blogheart' ), 'not_found_in_trash' => _x( 'No blog heart found in Trash', 'blogheart' ), 'parent_item_colon' => _x( 'Parent blogheart:', 'blogheart' ), 'menu_name' => _x( 'Blog Heart', 'blogheart' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'menu_icon' => 'http://0.gravatar.com/blavatar/ad954c75259323ec69b56683eb96ae42?s=16', 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post' ); register_post_type( 'blogheart', $args ); ?>