array( 'name' => __( 'Akram Templates', 'akram' ), 'singular_name' => __( 'Template', 'akram' ), 'add_new_item' => __( 'Add New Template', 'akram' ), 'edit_item' => __( 'Edit Template', 'akram' ), ), 'public' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'show_ui' => true, 'show_in_menu' => false, 'show_in_nav_menus' => false, 'show_in_rest' => false, 'rewrite' => array( 'slug' => 'nx-template' ), 'capability_type' => 'page', 'map_meta_cap' => true, 'supports' => array( 'title', 'author', 'thumbnail' ), 'has_archive' => false, 'query_var' => true, ) ); register_post_type( 'akram_submission', array( 'labels' => array( 'name' => __( 'Form Submissions', 'akram' ) ), 'public' => false, 'show_ui' => false, 'capability_type' => 'page', 'map_meta_cap' => true, 'supports' => array( 'title' ), 'rewrite' => false, ) ); register_post_type( 'akram_revision', array( 'public' => false, 'show_ui' => false, 'rewrite' => false, 'supports' => array( 'title', 'author' ), ) ); register_post_meta( 'akram_template', '_akram_type', array( 'type' => 'string', 'single' => true, 'show_in_rest' => false, 'auth_callback' => static function () { return current_user_can( 'edit_pages' ); }, ) ); } public static function template_type( $post_id ) { $type = get_post_meta( $post_id, '_akram_type', true ); return in_array( $type, self::TEMPLATE_TYPES, true ) ? $type : 'section'; } public static function type_labels() { return array( 'header' => __( 'Header', 'akram' ), 'footer' => __( 'Footer', 'akram' ), 'single' => __( 'Single', 'akram' ), 'archive' => __( 'Archive', 'akram' ), 'search' => __( 'Search results', 'akram' ), '404' => __( '404 page', 'akram' ), 'loop' => __( 'Loop item', 'akram' ), 'popup' => __( 'Popup', 'akram' ), 'section' => __( 'Section', 'akram' ), 'page' => __( 'Page', 'akram' ), 'component' => __( 'Global component', 'akram' ), 'mega' => __( 'Mega menu', 'akram' ), ); } }