这就是我的工作方式谢谢你的帮助
$type_1 = get_posts(array(
\'post_type\' => \'type_1\',
\'posts_per_page\' => 1,
\'orderby\' => \'date\',
\'order\' => \'DESC\'
));
$type_1_query_obj = $type_1[0];
$type_1_date = $type_1_query_obj->post_date;
$type_1_name = $type_1_query_obj->post_title;
$type_2 = get_posts(array(
\'post_type\' => \'type_2\',
\'posts_per_page\' => 1,
\'orderby\' => \'date\',
\'order\' => \'DESC\'
));
$type_2_query_obj = $type_2[0];
$type_2_date = $type_2_query_obj->post_date;
$type_2_name = $type_2_query_obj->post_title;
//compare the dates
if( strtotime($type_1_date) > strtotime($type_2_date) ) {
echo $type_1_name;
}else{
echo $type_2_name;
}