I often need to create some custom templates for home page & blog page. And those pages must not be deleted for my custom functions to work as I planed. But often clients forget about it & just erase those pages or edit them & then complaining to me that their website is broken.
So, I thought it would be nice to move all that “do not touch” pages to some custom posts type & just hide it from admin panel & prevent to modify.
So, is there any way to assign custom post type as home page or blog page?
I created custom post inside init
hook like this:
$labels = array(
'name' => _x( 'Important pages', 'post type general name', 'somedomainname' ),
'singular_name' => _x( 'Important page', 'post type singular name', 'somedomainname' ),
'menu_name' => _x( 'Important pages', 'admin menu', 'somedomainname' ),
'name_admin_bar' => _x( 'Important page', 'add new on admin bar', 'somedomainname' ),
'add_new' => _x( 'Add new', 'book', 'somedomainname' ),
'add_new_item' => __( 'Add new important page', 'somedomainname' ),
'new_item' => __( 'New important page', 'somedomainname' ),
'edit_item' => __( 'Edit important page', 'somedomainname' ),
'view_item' => __( 'Show important page', 'somedomainname' ),
'all_items' => __( 'All important pages', 'somedomainname' ),
'search_items' => __( 'Search important page', 'somedomainname' ),
'parent_item_colon' => __( 'Parent important page:', 'somedomainname' ),
'not_found' => __( 'Important pages not found', 'somedomainname' ),
'not_found_in_trash' => __( 'No important pages in trash.', 'somedomainname' )
);
$args = array(
'public' => true,
'label' => 'Important pages',
'supports' => array( 'title', 'editor', 'thumbnail'),
'labels' => $labels,
);
register_post_type( 'important_page', $args );
But for now I clearly don’t see how to assign any of ‘Important pages’ to home or blog page.