value()` * @param int $object_id The ID of the current object * @param string $object_type The type of object you are working with. * Most commonly, `post` (this applies to all post-types), * but could also be `comment`, `user` or `options-page`. * @param object $field_type_object The `CMB2_Types` object */ function aam_cmb2_render_combination_field_callback( $field, $value, $object_id, $object_type, $field_type_object ) { // make sure we specify each part of the value we need. $value = wp_parse_args( $value, array( 'school' => '', 'program' => '', 'intake' => '', 'combination' => '', 'round' => '' ) ); //get schools $args = array( 'post_type' => 'school' ); $query = new WP_Query($args); $schools = ''; foreach($query->get_posts() as $school) { $schools .= ''; } //get post if editing /*$school_id = 0; if($value['school'] != '') { $school_id = get_post_meta($value['school'], '_aam_combination_school', true); }*/ $pgs = ''; //get programs $args = array( 'post_type' => 'school', ); if($value['school'] != '') { $args['p'] = $value['school']; $query = new WP_Query( $args ); foreach ( $query->get_posts() as $school ) { $programs = get_post_meta( $school->ID, '_aam_school_programs_group', true ); foreach ( $programs as $program ) { $pgs .= ''; } } } //get intake $intks = ''; if ($value['school'] != '' && $value['program'] != '') { $intakes = get_terms( array( 'taxonomy' => 'intake', 'hide_empty' => false ) ); foreach($intakes as $intake) { $intks .= ''; } } /*//get combinations $cbs = ''; if($value['school'] != '' && $value['program'] != '' && $value['intake'] != '') { $args = array( 'post_type' => 'combination', 'tax_query' => array( array( 'taxonomy' => 'intake', 'field' => 'term_id', 'terms' => $value['intake'] ), ), 'meta_query' => array( array( 'key' => '_aam_combination_school', 'value' => $value['school'], 'compare' => '=', ), array( 'key' => '_aam_combination_program', 'value' => $value['program'], 'compare' => '=', ), ) ); $query = new WP_Query($args); if($query->have_posts()) { foreach ( $query->get_posts() as $comb ) { $r = get_post_meta( $comb->ID, '_aam_combination_rounds', true ); $cbs .= ''; } } }*/ //get rounds $rds = ''; if($value['combination'] != '') { $rounds = get_post_meta( $value['combination'], '_aam_combination_rounds', true ); for($i = 1; $i <= $rounds; $i++) { $rds .= ''; } } ?>
Please select School, Program and Intake to search for combinations