如何通过自定义日期时间选择器订购自定义帖子类型?

时间:2019-05-03 10:54:47

标签: wordpress wordpress-theming

我正在尝试按最接近用户的日期订购事件列表。我正在使用高级自定义字段插件使用日期时间选择器。

但是,事件似乎是在发布日期之前呈现的,而不是我创建的自定义日期时间选择器。

这是一个使用Timber作为模板引擎的Wordpress应用程序。

        $context['events'] = Timber::get_posts(
            array(
                'post_type' => 'event',
                'order'     => 'ASC',
                'order_by'  => 'date_and_time_of_event',
            )
        );

预期结果是该页面通过date_and_time_of_event渲染事件列表,并首先显示最接近用户的日期。

但是我认为事件列表是使用post_date而不是必需的date_and_time_of_event呈现的。

1 个答案:

答案 0 :(得分:1)

fun openCamera() {
    try {
        val imageFile = createImageFile()
        val callCameraIntent =  Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        if(callCameraIntent.resolveActivity(activity.packageManager) != null) {
            val authorities = activity.packageName + ".fileprovider"
            this.imageUri = FileProvider.getUriForFile(context, authorities, imageFile)
            callCameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri)
            startActivityForResult(callCameraIntent, IMAGE_PICK_CODE)
        }
    } catch (e: IOException) {
        Toast.makeText(context, "Could not create file!", Toast.LENGTH_SHORT).show()
    }
}

尝试

相关问题