1. To create custom post type http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-wordpress/
2. To create different single post template for each post type use single-{post-type name}.php
3. To create different archieve template for each post type use archieve-{post-type name}.php
4. If single page not working for custom post type
Add this to your functions.php:
/* Flush rewrite rules for custom post types. */
add_action( 'after_switch_theme', 'bt_flush_rewrite_rules' );
/* Flush your rewrite rules */
function bt_flush_rewrite_rules() {
flush_rewrite_rules();
}
Then change your theme to a different theme and then set it back again to your custom theme. This will flush the rewrite rule and making the custom post working properly.
2. To create different single post template for each post type use single-{post-type name}.php
3. To create different archieve template for each post type use archieve-{post-type name}.php
4. If single page not working for custom post type
Add this to your functions.php:
/* Flush rewrite rules for custom post types. */
add_action( 'after_switch_theme', 'bt_flush_rewrite_rules' );
/* Flush your rewrite rules */
function bt_flush_rewrite_rules() {
flush_rewrite_rules();
}
Then change your theme to a different theme and then set it back again to your custom theme. This will flush the rewrite rule and making the custom post working properly.
Comments
Post a Comment