__('Templates','mfn-opts'), 'singular_name' => __('Template','mfn-opts'), 'add_new' => __('Add New','mfn-opts'), 'add_new_item' => __('Add New Template','mfn-opts'), 'edit_item' => __('Edit Template','mfn-opts'), 'new_item' => __('New Template','mfn-opts'), 'view_item' => __('View Template','mfn-opts'), 'search_items' => __('Search Template','mfn-opts'), 'not_found' => __('No templates found','mfn-opts'), 'not_found_in_trash' => __('No templates found in Trash','mfn-opts'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'menu_icon' => 'dashicons-schedule', 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'rewrite' => array( 'slug' => 'template-item', 'with_front'=>true ), 'supports' => array( 'title' ), ); register_post_type( 'template', $args ); } } add_action( 'init', 'mfn_template_post_type' ); /*-----------------------------------------------------------------------------------*/ /* Define Metabox Fields /*-----------------------------------------------------------------------------------*/ $mfn_template_meta_box = array( 'id' => 'mfn-meta-template', 'title' => __('Template Options','mfn-opts'), 'page' => 'template', 'context' => 'normal', 'priority' => 'high', 'fields' => array(), ); /*-----------------------------------------------------------------------------------*/ /* Add metabox to edit page /*-----------------------------------------------------------------------------------*/ if( ! function_exists( 'mfn_template_meta_add' ) ) { function mfn_template_meta_add() { global $mfn_template_meta_box; add_meta_box($mfn_template_meta_box['id'], $mfn_template_meta_box['title'], 'mfn_template_show_box', $mfn_template_meta_box['page'], $mfn_template_meta_box['context'], $mfn_template_meta_box['priority']); } } add_action('admin_menu', 'mfn_template_meta_add'); /*-----------------------------------------------------------------------------------*/ /* Callback function to show fields in meta box /*-----------------------------------------------------------------------------------*/ if( ! function_exists( 'mfn_template_show_box' ) ) { function mfn_template_show_box() { global $MFN_Options, $mfn_template_meta_box, $post; $MFN_Options->_enqueue(); // Use nonce for verification echo '