我不知道为什么foreach循环仍在为我的$education
变量此代码应该获取自定义的post字段。它与标题、图像和about变量一起使用,但在将变量放入数组时不起作用。
<?php $args = array( \'post_type\' => \'team members\', \'posts_per_page\' => 40 , \'paged\' => 1,);
$loop = new WP_Query( $args );
$counter = 1;
while ( $loop->have_posts() ) : $loop->the_post();
$title = get_the_title();
$about = get_post_custom_values(\'about\');
$education = get_post_custom_values(\'education\');
$certications = get_post_custom_values(\'certications\');
$image_upload = get_post_meta($post->ID, \'profile_image\', true); // CALL IMAGE
echo \'<div class="tab blue black \'. join( \' \', get_post_class() ) .\'"><input id="inputnumber\' . $counter . \'" type="checkbox" name="group1" class="trigger"><label for="inputnumber\' . $counter . \'">\' . $title . \'</label> <span class="content">\' . $about[0] . \'</span></div>\';
foreach($education as $value) {
echo $value; // Displays "12" (there are 12 tracks on this album)
}
echo wp_get_attachment_image($image_upload); // Echo image
endwhile;
?>
更新:vardump打印填充的行数,但不打印这些行的实际内容。我试图调用的自定义字段是一个包含内容的小表。