true, 'show_in_rest' => true, 'has_archive' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'revisions', 'page-attributes' ), ); $types = array( 'bm_project' => array( 'menu_icon' => 'dashicons-building', 'rewrite' => array( 'slug' => _x( 'projects', 'URL slug', 'blockmason-core' ), 'with_front' => false, ), 'labels' => array( 'name' => _x( 'Projects', 'post type general name', 'blockmason-core' ), 'singular_name' => _x( 'Project', 'post type singular name', 'blockmason-core' ), 'add_new_item' => __( 'Add New Project', 'blockmason-core' ), 'edit_item' => __( 'Edit Project', 'blockmason-core' ), 'new_item' => __( 'New Project', 'blockmason-core' ), 'view_item' => __( 'View Project', 'blockmason-core' ), 'search_items' => __( 'Search Projects', 'blockmason-core' ), 'not_found' => __( 'No projects found.', 'blockmason-core' ), 'not_found_in_trash' => __( 'No projects found in Trash.', 'blockmason-core' ), 'all_items' => __( 'All Projects', 'blockmason-core' ), 'archives' => __( 'Project Archives', 'blockmason-core' ), ), ), 'bm_service' => array( 'menu_icon' => 'dashicons-hammer', 'rewrite' => array( 'slug' => _x( 'services', 'URL slug', 'blockmason-core' ), 'with_front' => false, ), 'labels' => array( 'name' => _x( 'Services', 'post type general name', 'blockmason-core' ), 'singular_name' => _x( 'Service', 'post type singular name', 'blockmason-core' ), 'add_new_item' => __( 'Add New Service', 'blockmason-core' ), 'edit_item' => __( 'Edit Service', 'blockmason-core' ), 'new_item' => __( 'New Service', 'blockmason-core' ), 'view_item' => __( 'View Service', 'blockmason-core' ), 'search_items' => __( 'Search Services', 'blockmason-core' ), 'not_found' => __( 'No services found.', 'blockmason-core' ), 'not_found_in_trash' => __( 'No services found in Trash.', 'blockmason-core' ), 'all_items' => __( 'All Services', 'blockmason-core' ), 'archives' => __( 'Service Archives', 'blockmason-core' ), ), ), 'bm_team_member' => array( 'menu_icon' => 'dashicons-groups', 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'page-attributes' ), 'rewrite' => array( 'slug' => _x( 'team', 'URL slug', 'blockmason-core' ), 'with_front' => false, ), 'labels' => array( 'name' => _x( 'Team', 'post type general name', 'blockmason-core' ), 'singular_name' => _x( 'Team Member', 'post type singular name', 'blockmason-core' ), 'add_new_item' => __( 'Add New Team Member', 'blockmason-core' ), 'edit_item' => __( 'Edit Team Member', 'blockmason-core' ), 'new_item' => __( 'New Team Member', 'blockmason-core' ), 'view_item' => __( 'View Team Member', 'blockmason-core' ), 'search_items' => __( 'Search Team', 'blockmason-core' ), 'not_found' => __( 'No team members found.', 'blockmason-core' ), 'not_found_in_trash' => __( 'No team members found in Trash.', 'blockmason-core' ), 'all_items' => __( 'All Team Members', 'blockmason-core' ), 'archives' => __( 'Team', 'blockmason-core' ), ), ), 'bm_testimonial' => array( // Testimonials are shown through blocks, not as pages of their own. 'public' => false, 'show_ui' => true, 'publicly_queryable' => false, 'exclude_from_search' => true, 'has_archive' => false, 'rewrite' => false, 'menu_icon' => 'dashicons-format-quote', 'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'page-attributes' ), 'labels' => array( 'name' => _x( 'Testimonials', 'post type general name', 'blockmason-core' ), 'singular_name' => _x( 'Testimonial', 'post type singular name', 'blockmason-core' ), 'add_new_item' => __( 'Add New Testimonial', 'blockmason-core' ), 'edit_item' => __( 'Edit Testimonial', 'blockmason-core' ), 'new_item' => __( 'New Testimonial', 'blockmason-core' ), 'search_items' => __( 'Search Testimonials', 'blockmason-core' ), 'not_found' => __( 'No testimonials found.', 'blockmason-core' ), 'not_found_in_trash' => __( 'No testimonials found in Trash.', 'blockmason-core' ), 'all_items' => __( 'All Testimonials', 'blockmason-core' ), ), ), ); foreach ( $types as $post_type => $args ) { /** * Filters the arguments of a Blockmason content type. * * @param array $args Arguments for register_post_type(). * @param string $post_type Post type key. */ $args = apply_filters( 'blockmason_core_post_type_args', array_merge( $common, $args ), $post_type ); register_post_type( $post_type, $args ); } } /** * Lists services and team members in their manual order (Order attribute) * on their archive pages. * * @param \WP_Query $query The query. */ function archive_order( $query ) { if ( is_admin() || ! $query->is_main_query() || ! $query->is_post_type_archive( array( 'bm_service', 'bm_team_member' ) ) ) { return; } $query->set( 'orderby', array( 'menu_order' => 'ASC', 'title' => 'ASC', ) ); }