array( 'name' => __( 'Team' ), 'singular_name' => __( 'Employee' ) ), 'public' => true, 'has_archive' => false, 'rewrite' => array( 'slug' => 'team' ), ) ); } function imbb_register_metabox() { $prefix = 'imbb_'; $cmb = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => esc_html__( 'Options', 'cmb2' ), 'object_types' => array( 'team', ), // Post type )); $cmb->add_field( array( 'name' => esc_html__( 'Designation', 'cmb2' ), 'desc' => esc_html__( 'Role in the team', 'cmb2' ), 'id' => $prefix . 'designation', 'type' => 'text_small', )); $cmb->add_field( array( 'name' => esc_html__( 'Portrait', 'cmb2' ), 'desc' => esc_html__( 'Upload an image or enter a URL.', 'cmb2' ), 'id' => $prefix . 'image', 'type' => 'file', ) ); $cmb->add_field( array( 'name' => esc_html__( 'Level', 'cmb2' ), 'desc' => esc_html__( 'A number from 0 to 3; 0 means galaxy center, 1 means first circle; max is 3', 'cmb2' ), 'id' => $prefix . 'level', 'type' => 'text_small', )); $cmb->add_field( array( 'name' => esc_html__( 'Circle color', 'cmb2' ), 'id' => $prefix . 'color', 'type' => 'colorpicker', 'default' => '#ffffff', )); } function galaxyuser($post, $i) { ?> <?php echo $post->post_title ?>
post_content; ?> ID, 'imbb_designation', TRUE ); ?>
'team', 'post_status' => 'publish', 'posts_per_page' => 10, )); ?>
ID, 'imbb_color', TRUE ); if ($color === '#ffffff' || $color === '') { $color = 'rgb('.rand(0,255).', '.rand(0,255).', '.rand(0,255).')'; } ?>
ID, 'imbb_level', TRUE ); if ($level === "") { $level = 3; } else { $level = (int) $level; } if (!isset($posts[$level])) { $posts[$level] = []; } $posts[$level][] = $post; } foreach ($posts[3] as $post) { galaxyuser($post, $i); $i++; } ?>
ID, 'imbb_image', TRUE ).'">'; $i++; } } ?>