0
query_posts(array(
'post_type' => 'ts_result',
'meta_query' => array(
array(
'key' => '_ts_student_class',
'value' => $exam_reg,
'compare' => '='
),
array(
'key' => '_ts_school_term',
'value' => $exam_term,
),
array(
'key' => '_ts_school_year',
'value' => $exam_year,
)
),
'posts_per_page' => 100
)
);
?>
<table style="border:1px solid black" cellpadding="1.5" cellspacing="5">
<style type="text/css" media="print">
table{
border-collapse:collapse;
}
</style>
<tbody>
<tr>
<th><strong>NAME\SUBJECT</strong></th>
<th><strong>English Studies</strong></th>
<th align='center'><strong>Mathematics</strong></th>
<th align='center'><strong>CCA</strong></th>
<th align='center'><strong>Yoruba Language</strong></th>
<th align='center'><strong>French</strong></th>
<th align='center'><strong>Business Education</strong></th>
</tr>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$subject_english_studies_exam_total= get_post_meta(
get_the_ID(),'_ts_subject_english_studies_exam_total',true);
$subject_maths_exam_total= get_post_meta(
get_the_ID(),'_ts_subject_maths_exam_total',true);
$subject_creative_arts_exam_total= get_post_meta(
get_the_ID(),'_ts_subject_creative_arts_exam_total',true);
$subject_yoruba_lang_exam_total= get_post_meta(
get_the_ID(),'_ts_subject_yoruba_lang_exam_total',true);
$subject_french_exam_total= get_post_meta(
get_the_ID(),'_ts_subject_french_exam_total',true);
$subject_business_edu_exam_total= get_post_meta(
get_the_ID(),'_ts_subject_business_edu_exam_total',true);
?>
<tr>
<td><?php the_title(); ?></td>
<td><?php echo $subject_english_studies_exam_total ;?></td>
<td><?php echo $subject_maths_exam_total ;?></td>
<td><?php echo $subject_creative_arts_exam_total ;?></td>
<td><?php echo $subject_yoruba_lang_exam_total ;?></td>
<td><?php echo $subject_french_exam_total ;?></td>
<td><?php echo $subject_business_edu_exam_total ;?></td>
</tr>
</tbody>
</table>
在WordPress的上面的查詢返回如下:返回帖子單表
我尋求實現是一個頭,另一個帖子內容爲行的表。目前只有第一個帖子值被格式化爲表格行。
你是否介意查找[這個問題對我來說](https://stackoverflow.com/questions/44212837/calculate-position-rank-for-returned-post) –