August 21, 2016
0
Register custom post type in WordPress
For register custom post type in WordPress this Article will helpful for you.
add_action( 'init', 'unique_function_name' );
function unique_function_name() {
$args = array(
'description' => 'Custom Post description',
'show_ui' => true,
'menu_position' => 4,
'exclude_from_search' => true,
'labels' => array(
'name' => 'Custom Post Name',
'singular_name' => 'Custom Post Name',
'add_new' => 'Add Custom Post',
'add_new_item' => 'Add Custom Post',
'edit' => 'Edit Posts',
'edit_item' => 'Edit Post',
'new-item' => 'New Post',
'view' => 'View Post',
'view_item' => 'View Post',
'search_items' => 'Search Post',
'not_found' => 'No Result Found',
'not_found_in_trash' => 'No Result Found',
'parent' => 'Parent Post'
),
'public' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'supports' => array('title', 'editor', 'thumbnail')
);
register_post_type( 'post_type_name' , $args );
}
You can use this code on your functions.php
or if you want you can write this code on a separate page (custom-post.php)
then (custom-post.php) include in your functions.php
You can use this code in your functions.php for include that php (custom-post.php) file
require_once("custom-post.php");