我想在学校网站上显示每天的生日。老师和学生的生日有不同的部分。我只想查询老师的生日。我的自定义字段是位置(教师或学生-选择输入)、出生日期(日期选择器)。我的代码如下所示:
<?php
$today = date(\'d/m\');
$args = array(
\'post_type\' => \'birthday\',
\'posts_per_page\' => 1,
\'meta_query\' => array(
array(
\'key\' => \'field_position\',
\'value\' => \'Teacher\'
)
array(
\'key\' => \'field_dob\',
\'value\'=> $today
)
);
$the_query = new WP_Query($args);
?>
<?php if($the_query->have_posts()) : while($the_query->have_posts()): $the_query->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>