1 回答

TA貢獻1797條經驗 獲得超6個贊
雖然我不知道這些字段是如何存儲在數據庫中的,但這可能會為您指明正確的方向comp_closing。closing_time
$today = date('Y-m-d');
$time = date('H:i:s');
$compCount = array(
'post_type' => 'product',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'OR',
// make sure the date is after the current date...
array(
'key' => 'comp_closing',
'compare' => '>',
'value' => $today,
),
// ...or if the date is the same...
array(
'relation' => 'AND',
array(
'key' => 'comp_closing',
'compare' => '=',
'value' => $today,
),
// ...make sure we didn’t hit the time yet.
array(
'key' => 'closing_time',
'compare' => '>',
'value' => $time,
)
)
),
'orderby' => 'meta_value_num',
'order' => 'ASC',
);
- 1 回答
- 0 關注
- 102 瀏覽
添加回答
舉報