WordPress has an awesome feature which is known as custom post types which are useful to organize and a different kinds of posts.
In this tutorial i will explain you about creating posts for your wordpress blog. There are two methods to create custom post types.
1. By Hardcoding.
2. By Installing plugin.
We must know both of the methods for creating custom post types.
If you hardcode you have to add the following code in the functions.php which is located in your theme files.
In this tutorial i will explain you about creating posts for your wordpress blog. There are two methods to create custom post types.
1. By Hardcoding.
2. By Installing plugin.
We must know both of the methods for creating custom post types.
If you hardcode you have to add the following code in the functions.php which is located in your theme files.
add_action('init', 'cptui_register_my_cpt'); function cptui_register_my_cpt() { register_post_type('movies', array( 'label' => '__('movie')', 'description' => '', 'public' => 'true', 'show_ui' => 'true', 'show_in_menu' => 'true', 'capability_type' => 'post', 'hierarchical' => 'false', 'rewrite' => array('slug' => 'movies', 'with_front' => '1'), 'query_var' => 'true', 'exclude_from_search' => 'false', 'supports' => array(''title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes','post-formats','), 'labels' => 'array ( 'name' => 'movie', 'singular_name' => '', 'menu_name' => 'movie', 'add_new' => 'Add movie', 'add_new_item' => 'Add New movie', 'edit' => 'Edit', 'edit_item' => 'Edit movie', 'new_item' => 'New movie', 'view' => 'View movie', 'view_item' => 'View movie', 'search_items' => 'Search movie', 'not_found' => 'No movie Found', 'not_found_in_trash' => 'No movie Found in Trash', 'parent' => 'Parent movie', )' ) ); }
here is a simple tut for looping of custom post type posts..
ReplyDeletehttp://kvcodes.com/2014/03/loop-specific-post-type-and-categories/