我在WordPress中使用Visual Composer,因为我需要显示与当前日期相比的过去事件。我试过这个。
$today = date('yymmdd');
$args = array(
'post_type' => 'event',
'meta_query' => array(
array(
'key' => 'date_short_order',
'value' => date("yymmdd"),
'compare' => '<',
'type' => 'DATE'
)
)
);
任何人帮助我。
答案 0 :(得分:1)
你有没有试过这个?
const _ = require('lodash');
module.exports.storageDetail = function(req, res) {
User.findOne({'userId': req.user.userId}, 'storages').then(function(data){
var storageArray = [];
let queries = _.map(data.storages, (record)=>{
return Storage.findOne({_id: record}, function(err, storage){
storageArray.push(storage);
});
})
return Promise.all(queries);
}).then(function(storageList){
res.render('storage_template', {
storage: storageList
});
console.log(storageList);
});
}
我将此$today = date('yymmdd');
$args = array(
'post_type' => 'event',
'meta_query' => array(
array(
'key' => 'date_short_order',
'value' => date("Y-m-d"),
'compare' => '<',
'type' => 'DATE'
)
)
);
替换为'value' => date("yymmdd"),