计算退回帖子的位置/等级

时间:2017-05-27 04:01:52

标签: php wordpress cmb2

这是自定义帖子声明

action="contact"

后端元框

function ts_result_reg() {
$labels = array(
'name' => _x( 'Students Result', 'post type general name' ),
'singular_name' => _x( 'Students Result', 'post type singular name' ),
'add_new' => _x( 'Add New Result', 'result' ),
'add_new_item' => __( 'Add New Result' ),
'edit_item' => __( 'Edit Result' ),
'new_item' => __( 'New Result' ),
'all_items' => __( 'All Results' ),
'view_item' => __( 'View Result' ),
'search_items' => __( 'Search Results' ),
'not_found' => __( 'No result found' ),
'not_found_in_trash' => __( 'No result found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Student Results'
 );
 $args = array(
 'labels' => $labels,
 'description' => 'Add new custom post type students result',
 'public' => true,
 'menu_position' => 5,
 'supports' => array( 'thumbnail','title', ),
 'taxonomies' => array( 'classes' ),
 'has_archive' => true,
 'rewrite'=> array ('slug' => 'tscheck'),
 );
 register_post_type( 'ts_students_result', $args );
 }
 add_action( 'init', 'ts_result_reg' );

前端查询

array(
            'name' => 'French',
            'id'   => $prefix . 'subject_french_exam_total',
            'type' => 'text_small',
            // 'repeatable' => true,
        ),

array(
            'name' => 'Business Education,
            'id'   => $prefix . 'subject_business_edu_exam_total',
            'type' => 'text_small',
            // 'repeatable' => true,
        ),

        ...

编辑:在上面的代码(缩短)中,我需要计算每个帖子平均值的位置(等级)。似乎整个循环不在输出之前在wordpress中运行,因此,每个帖子的输出为1(screenshot of output)。我该如何解决这个问题?

0 个答案:

没有答案