如果今天发布了帖子,如何显示内容?
像这样:
The Post. _new_
The Post. _old_
如果今天发布了帖子,如何显示内容?
像这样:
The Post. _new_
The Post. _old_
您可以使用get_the_time()
获取当前帖子的日期。只需使用仅包含年份和日期的格式,并使用current_time()
具有相同格式的函数:
if ( get_the_time( \'Yd\' ) === current_time( \'Yd\' ) ) {
// Post was published today.
}
我正在尝试使用URL参数修改我的“事件”自定义帖子类型的查询,方法是使用following:function my_pre_get_posts($query) { // do not modify queries in the admin if (is_admin()) { return $query; } // only modify qu